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

## 系统极其郁闷的测试数据

Posted by majiavon at 2008-10-27 03:38:07 on Problem 3517

#include <stdio.h>
int f(int n,int s,int m)
{
int ans,i,r=0;
for(i=2;i<=n;i++)
{
r=(r+m)%i;
}
ans=(r+s)%n;
if(ans==0)  ans=n;
return ans;
}

int main()
{
int n,s,m;
while(1)
{
scanf("%d %d %d",&n,&s,&m);
if(n==0||s==0||m==0||s>n)  break;
printf("%d\n",f(n,s,m));
}
return 0;
}

#include <stdio.h>
int f(int n,int s,int m)
{
int ans,i,r=0;
for(i=2;i<=n;i++)
{
r=(r+m)%i;
}
ans=(r+s)%n;
if(ans==0)  ans=n;
return ans;
}

int main()
{
int n,s,m;
int count;

while(1)
{
scanf("%d %d %d",&n,&m,&s);
if(n==0 && m==0 && s==0)break;
if(m==0||s==0||s>n)
{
continue;
}
for(count=1;count<=m-1;count++)
{
s=(s-1)%n;
if(s==0) s=n;
}
printf("%d\n",f(n,s,m));
}
return 0;
}

if(m==0||s==0||s>n)
{
continue;
}

Followed by: