Created
May 29, 2010 00:07
-
-
Save anonymous/417905 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
/* http://pc12.2ch.net/test/read.cgi/tech/1261057499/975 | |
*/ | |
#include <stdio.h> | |
void swap(int *a, int *b){ | |
int t; | |
t=*a,*a=*b,*b=t; | |
} | |
int main(void){ | |
int i1, i2, i3, i4, i5, i6, i7, i=0, j[7], k, m; | |
for(i1=1; i1<=9; i1++){ | |
for(i2=i1; i2<=9; i2++){ | |
if(i1+i2 >= 10) break; | |
for(i3=i2; i3<=9; i3++){ | |
if(i1+i2+i3 >= 11) break; | |
for(i4=i3; i4<=9; i4++){ | |
if(i1+i2+i3+i4 >= 12) break; | |
for(i5=i4; i5<=9; i5++){ | |
if(i1+i2+i3+i4+i5 >= 13) break; | |
for(i6=i5; i6<=9; i6++){ | |
if(i1+i2+i3+i4+i5+i6 >= 14) break; | |
for(i7=i6; i7<=9; i7++){ | |
if(i1+i2+i3+i4+i5+i6+i7 == 15){ | |
printf("%d+%d+%d+%d+%d+%d+%d\n", i1, i2, i3, i4, i5, i6, i7); | |
i++; | |
} | |
}}}}}}} | |
printf("正解の個数は %d 個\n", i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment