Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哪位帮我看看这个代码哪里有问题 谢了

Posted by nzomkxia at 2008-06-15 10:29:55 on Problem 1978 and last updated at 2008-06-15 10:30:10
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator