俄罗斯方块

http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=1568&cid=1130

View Code
 1 #include<stdio.h>
 2 #include<string.h>
 3 int main()
 4 {
 5     char s[30][30];
 6     int h, w, i, j, count = 0, sum[30] = {0};
 7     scanf("%d %d%*c",&h, &w);
 8     for(i=0; i < h; i++)
 9     gets(s[i]) ;
10     for(i=0; i < h; i++)
11     {
12         for(j = 0; s[i][j] != 0; j++)
13             sum[i] += (s[i][j] - '0');
14         if(sum[i] == w)
15             count++;
16     }
17     while(count--)
18     {
19         for(i = 0; i < w; i++)
20             printf("0");
21         printf("\n");
22     }
23     for(i = 0; i < h; i++)
24 
25     {
26         if(sum[i] != w)
27             puts(s[i]) ;
28     }
29     return 0;
30 }


输入输出不能用scanf,printf和二维数组表示,很不能理解

posted @ 2013-01-26 20:51  yelan@yelan  阅读(155)  评论(0编辑  收藏  举报