| ||||||||||
| 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 | |||||||||
不超时++In Reply To:超时和不超时 Posted by:orangelegend at 2008-09-24 21:20:24 #include <stdio.h>
#include <string.h>
int main()
{
int m,n,i,j;
while (scanf("%d",&n) != EOF && n != 0)
{
m = 1;
while(1)
{
i = 0;
j = n - 1;
while (j != 0)
{
i = (i + m - 1) % j;
j--;
if (i == 0)
break;
}
if (j == 0)
{
printf("%d\n",m);
break;
}
m++;
}
}
return 0;
}
16ms
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator