1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| #include<iostream> #include<cstdio> #include<cstdio> #include<algorithm> #define ll long long using namespace std; ll n,k; ll cur; int main(){ cin>>n>>k; cur=0; for(int i=2;i<=n;i++){ cur=(cur+k)%i; } cur++; cout<<cur<<endl; return 0; }
|