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<stdio.h> int main() { int n,r,i,j,t,temp,c; int b[100][2]; int a[51]; for(i=1;i<51;i++) a[i]=i; scanf("%d %d",&n,&r); if(n!=0&&r!=0) { for(i=0;i<r;i++) for(j=0;j<2;j++) scanf("%d",&b[i][j]); for(c=0;c<r;c++) { temp=b[c][1]; while(temp--) { t=a[n+1-b[c][0]-b[c][1]+1]; for(i=n+1-b[c][0]-b[c][1]+1;i<n;i++) a[i]=a[i+1]; a[n]=t; } } printf("%d\n",a[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