1 solutions
-
0
C++ :
#include<cstdio> #include<cstdlib> #include<cstring> using namespace std; int main() { int M,N,t=0,x=0; scanf("%d%d",&M,&N); int a[M+10]; memset(a,0,sizeof(a)); while(x!=M-1) { for(int b=1;b<=M;++b) { if(a[b]==0) { ++t; } if(t==N) { t=0; a[b]=1; ++x; N=b; } } } for(int c=1;c<=M;++c) { if(a[c]==0) { printf("%d",c); } } return 0; }
- 1
Information
- ID
- 17155
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By