Untitled
unknown
plain_text
a year ago
323 B
4
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