Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
113
reputation
5

hasan83

// http://www.spoj.com/problems/ANARC08H/
#include <iostream>
using namespace std;
int main() {
    int n,k,d,i;
    while (cin>>n>>k && n != 0) {
        for (d=1,i=1; i<=n; d = (d + k) % i++);
        cout << n << " " << k << " " << d+1 << endl;
    }
    return 0;
}

Android & iOS Developer

https://itunes.apple.com/us/app/watershade/id992097863 (Go iPad)

https://itunes.apple.com/us/app/for9a-frst/id1112938957

https://itunes.apple.com/us/app/la3eeb/id1196447729

http://poj.org/userstatus?user_id=hasan83

hasanal_bukhari [AT] hotmail [DOT] com

0
answers
1
question
~84
people reached
  • Amman, Jordan
  • Member for 3 years, 3 months
  • 10 profile views
  • Last seen Feb 19 '18 at 10:50

Top Tags (2)

Score 0
Posts 1
Score 0
Posts 1

Top Posts (1) All Questions Answers | Votes Newest

2 Draw part of circle Dec 28 '15

Badges (5)

Gold

Silver

Bronze

5

Rarest