2 条题解
-
-2
太简单了
#include <iostream> using namespace std; bool a[1005]; int main() { int n,m,cnt=0,i=0,p=0; cin >> n >> m; while(i=i%n+1){ // cout << a[i] << " " << i << " " << cnt << " " << p << endl; if(cnt==n-1){ break; } if(a[i]==false){ p++; } if(p==m){ p=0; a[i]=true; cnt++; } } for(int i = 1; i <= n; i++){ if(a[i]==false){ cout << i; return 0; } } }
信息
- ID
- 1028
- 时间
- 1000ms
- 内存
- 32MiB
- 难度
- 7
- 标签
- 递交数
- 253
- 已通过
- 64
- 上传者