Created
October 13, 2016 22:01
-
-
Save ryuichimatsumoto-single/62ab09f335b9fc1a80b6e782f22c2539 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int a; | |
int b; | |
int p; | |
int start = 1; | |
int end = 50; | |
int count = 0; | |
for(a=start;a<end;a++) | |
{ | |
for(p=start;p<end;p++) | |
{ | |
for(b=start;b<end;b++) | |
{ | |
//ここで(左辺)=(右辺)を計算する | |
if(a*p*p -p - 8*a*b == 0) | |
{ | |
count++; | |
printf("(a,b,p)=(%d,%d,%d)\n",a,b,p); | |
} | |
} | |
} | |
} | |
printf("条件を満たす(a,b,p)の組:%d組\n",count); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment