Last active
September 28, 2016 15:25
-
-
Save ryuichimatsumoto-single/37bd9a11d0dab38519c339198da1b8cc to your computer and use it in GitHub Desktop.
This file contains 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 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