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 |
这样可算最优解吗?(这题不是模拟哦)#include <cstdio> int main() { int T, n, a[25], i, j; scanf("%d", &T); while(T--) { scanf("%d", &n); a[0] = 0; for(i = 1; i <= n; i++) { scanf("%d", &a[i]); j = i - 1; while(a[i] - a[j] < i - j) j--; printf("%d ", i - j); } printf("\n"); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator