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 799098386 at 2012-07-16 10:42:44 on Problem 3517
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
    int m,n,p;
    int i,j,k,g;
    int s,f,l;
    while(scanf("%d%d%d",&m,&n,&p)!=EOF&&m!=0)
    {
        s=0;
      for(i=2;i<=m;i++)
       s=(s+n)%i;
       n=n%m;
       if(n==0)
        n=m;
        l=s+1+p-n;
        if(l>=1&&l<=m) printf("%d\n",l);
        else if(l<1) printf("%d\n",l+m);
        else if(l>m) printf("%d\n",l%m);   
    }
    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