Untitled

mail@pastecode.io avatar
unknown
plain_text
24 days ago
323 B
1
Indexable
Never
#include <iostream>

using namespace std;

int main(){
    freopen("DT.INP","r",stdin);
    freopen("DT.OUT","w",stdout);

    int n, d, k; cin >> n >> d >> k;
    int i = 1, s = 1;
    while(k--){
        i += d;
        if(i > n)
            i -= n;
        s += i;
    }
    cout << s;

	return 0;
}
Leave a Comment