Skip to content

Instantly share code, notes, and snippets.

@ryuichimatsumoto-single
Created October 13, 2016 22:01
Show Gist options
  • Save ryuichimatsumoto-single/62ab09f335b9fc1a80b6e782f22c2539 to your computer and use it in GitHub Desktop.
Save ryuichimatsumoto-single/62ab09f335b9fc1a80b6e782f22c2539 to your computer and use it in GitHub Desktop.
#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