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 |
gcc代码 供各位参考 不解释#include<stdio.h> #include<string.h> int go(){ int p[25] = {0}, i, j, n, putt; scanf("%d",&n); for(i = 0; i < n; i++){ scanf("%d",&p[i]); } printf("1"); for(i = 1; i < n; i++){ putt = 1; for(j = i-1; j >= 0; j--){ if(p[j] != p[j+1]) break; p[j]--; putt++; } printf(" %d",putt); } printf("\n"); return 0; } int main(){ int n; scanf("%d",&n); while(n--) go(); system("pause"); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator