Skip to content

Instantly share code, notes, and snippets.

@ryuichimatsumoto-single
Last active September 28, 2016 15:25
Show Gist options
  • Save ryuichimatsumoto-single/37bd9a11d0dab38519c339198da1b8cc to your computer and use it in GitHub Desktop.
Save ryuichimatsumoto-single/37bd9a11d0dab38519c339198da1b8cc to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main()
{
int x = 0;
int y = 0;
int count = 0;
for(x=-100;x<101;x++)
{
for(y=-100;y<101;y++)
{
/*元の式だと分数が出てきて、intの範囲に収まり切らず
誤差が出るため、4倍した式をここに代入*/
if(4*x*x+4*x*y+y*y-8*y == 0)
{
count++;
printf("(%d,%d)\n",x,y);
}
}
}
printf("(%d)\n",count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment