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
110
reputation
6

hasan

// 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
2
questions
~75
people reached
  • Amman, Jordan
  • Member for 5 years, 5 months
  • 9 profile views
  • Last seen Mar 20 '18 at 8:50

Top Tags (3)

Score 0
Posts 1
Score 0
Posts 1
Score 0
Posts 1

Top Posts (2) All Questions Answers | Votes Newest

Badges (6)

Gold

Silver

Bronze

6

Rarest