mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
46c0830804
2900-2999
21 lines
379 B
C++
21 lines
379 B
C++
#include <cstdio>
|
|
#include <iostream>
|
|
#include <stdlib.h>
|
|
#include <memory.h>
|
|
#include <math.h>
|
|
#include <string.h>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
int n,d,w;
|
|
while(cin>>n>>d)
|
|
{
|
|
if(n==0&&d==0) break;
|
|
int ans=0;
|
|
for(int i=2;i<=n;i++)
|
|
ans=(ans+d)%i;
|
|
cout<<n<<" "<<d<<" "<<ans+1<<endl;
|
|
}
|
|
return 0;
|
|
}
|