Untitled
unknown
plain_text
2 years ago
323 B
5
Indexable
#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;
}
Editor is loading...
Leave a Comment