http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3057
典型的sg函数,数据范围卡得真好啊
代码
1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<cmath> 5 #include<iostream> 6 #include<map> 7 using namespace std; 8 int m,n,k; 9 bool a[310][310][310]={}; 10 int main(){ 11 for(int i=0;i<=301;i++){ 12 for(int j=0;j<=301;j++){ 13 for(int w=0;w<=301;w++){ 14 if(!a[i][j][w]){ 15 for(int t=i+1;t<=301;t++)a[t][j][w]=1; 16 for(int t=j+1;t<=301;t++)a[i][t][w]=1; 17 for(int t=w+1;t<=301;t++)a[i][j][t]=1; 18 19 for(int t=1;t+i<=301&&t+j<=301;t++)a[i+t][j+t][w]=1; 20 for(int t=1;t+j<=301&&t+w<=301;t++)a[i][j+t][w+t]=1; 21 for(int t=1;t+i<=301&&t+w<=301;t++)a[i+t][j][w+t]=1; 22 } 23 } 24 } 25 } 26 while(~scanf("%d%d%d",&m,&n,&k)){ 27 printf("%d ",a[m][n][k]); 28 } 29 return 0; 30 }