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 |
垃圾题目 做对了还说wa 非要第一种输出才对 第二种就不对#include"iostream" using namespace std; int flag[100],c[100]; int main() { int t,i,j,n,m; scanf("%d",&t); while(t--) { for(int i=1;i<100;i++) { flag[i]=1; c[i]=-1; } scanf("%d",&n); for(j=1;j<=n;j++) { scanf("%d",&m); for(i=m;i>=1;i--) if(flag[i]) { flag[i]=0; c[j]=m-i+1; break; } printf("%d ",c[j]); } printf("\n"); } } ********************************************************** #include"iostream" using namespace std; int flag[100],c[100]; int main() { int t,i,j,n,m; scanf("%d",&t); while(t--) { for(int i=1;i<100;i++) { flag[i]=1; c[i]=-1; } scanf("%d",&n); for(j=1;j<=n;j++) { scanf("%d",&m); for(i=m;i>=1;i--) if(flag[i]) { flag[i]=0; c[j]=m-i+1; break; } } for(i=1;i<n;i++) printf("%d ",c[i]); printf("%d\n",c[i]); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator