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 |
Why WA?谁能帮我看看……#include <stdio.h> int main() { int n,m,d[100],c[100],r[100]; int i,j,t; int s=2; scanf("%d",&n); while(n--) { scanf("%d",&m); for(j=0;j<m;j++) { scanf("%d",&d[j]); } c[0]=d[0]; for(j=1;j<m;j++) { c[j]=d[j]-d[j-1]; } for(j=0;j<m;j++) { if(c[j]!=0) r[j]=1; else { if(d[j]!=0) { for(t=j;c[t-1]==0&&t>0;t--) s++; t=j; while(c[t-1]<s&&t>0) t--; if(t!=0) r[j]=j-t+2; else r[j]=0; } else r[j]=0; } s=2; printf("%d ",r[j]); } printf("\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator