Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:题目过的越来越没水平了~~(附代码)In Reply To:题目过的越来越没水平了~~(附代码) Posted by:zjp at 2009-08-24 14:59:52 #include <stdio.h> int q[1000][1000], n, p, c , ans ; main () { int i, j, t , k ; while (scanf ("%d%d%d", &p, &n, &c), p | c | n){ ans = 0 ; for (i = 0 ;i < n ; i ++ ) for (j = 0 ; j < p ;j ++ ) scanf ("%d", &q[i][j]) ; for (i = 0 ; i < p ; i ++ ) for (j = 0 , t = 0 , k = 1 ; j < n ; j ++ ){ t += q[j][i] ; if (t >= c && k){ ans ++ ; k = 0 ;} if ( ! q[j][i]){t = 0 ; k = 1 ;} } printf ("%d\n", ans) ;} } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator