uva 457
View Code
留给自己看的程序 #include<stdio.h> #include<string.h> int main() { int T; scanf("%d",&T); while(T--) { int DNA[10] = {0},i; for(i = 0;i < 10; i++) scanf("%d",&DNA[i]); int temp[40] = {0}; temp[19] = 1; int s = 50; while(s--) { for(i = 0;i < 40; i++) { if(temp[i] == 0) printf(" "); else if(temp[i] == 1) printf("."); else if(temp[i] == 2) printf("x"); else printf("W"); } printf("\n"); int tail[40] = {0}; for(i = 0;i < 39; i++) tail[i] = DNA[temp[i-1]+temp[i+1]+temp[i]]; tail[0] = DNA[temp[0] + temp[1]]; tail[39] = DNA[temp[38] + temp[39]]; memcpy(temp,tail,40*sizeof(int)); } if(T != 0) printf("\n"); } return 0; }