Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: SonnyHappy108

Problemset: ของขวัญและขโมย

Language: cpp

Time: 0.002 second

Submitted On: 2026-04-11 16:37:56

#include <bits/stdc++.h>
using namespace std;
//done : 12
int main(){
	int a,b,c,p=1,h=0;
	bool q=false,r=false;
	cin >> a >> b >> c;
	c--;
	while (true){
		if(h==c){
			cout << p;
			break;
		}
		h=(h+b)%a;
		p++;
		
		if(!h){
			cout << p-1;
			break;
		}
	}
}