Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
785 B
0
Indexable
#include <bits/stdc++.h>
#define endl '\n'
#define maxn 105
#define MOD 1000000007

using namespace std;
int a[maxn],n,s,k,d = 0,x,res;
void inp(){
    cin >> n >> s >> k;
}
void solve(){
    int y = n;
    x = 1;
    while(y > 0)
    {
        if(a[x] == 0)
        {
            d++;
            if (d % s == 0)
            {
                a[x] = 1;
                y--;
                res = x;
            }
        }
        x++;
        if (x > n) x -= n;
    }
    int save = res-1;
    k -= save;
    if (k < 0) k += n;
    cout << res << endl << k;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen("bai1.inp","r")){
        freopen("bai1.inp","r",stdin);
    }
    inp();
    solve();
    return 0;
}
Leave a Comment