Skip to content

Instantly share code, notes, and snippets.

@ryuichimatsumoto-single
Created October 20, 2016 16:53
Show Gist options
  • Save ryuichimatsumoto-single/3534b781c6ac6cac4f6247417ed8bba8 to your computer and use it in GitHub Desktop.
Save ryuichimatsumoto-single/3534b781c6ac6cac4f6247417ed8bba8 to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main()
{
int x;
int y;
int z;
int p;
int start = 1;
int end = 10;
int count = 0;
for(x=start;x<end;x++)
{
for(y=x;y<end;y++)
{
for(z=y;z<end;z++)
{
for(p=start;p<end;p++)
{
//ここで(左辺)=(右辺)を計算する
if(x*y+y*z+z*x == p*x*y*z)
{
count++;
printf("(p,x,y,z)=(%d,%d,%d,%d)\n",p,x,y,z);
}
}
}
}
}
printf("条件を満たす(p,x,y,z)の組:%d組\n",count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment