求助
查看原帖
求助
1070313
ljh88888888楼主2024/10/23 22:34

为什么RE

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll t,x,a,b,y;
int main(){
	cin >> t;
	while(t--){
		cin >> x >> a >> b;
		if(a==1){
			cout << x%b-b << endl;
			continue;
		}
		
		while(1){
			y=a*x-b;
			if(y<0){
				cout << y << endl;
				break;
			}else if(y>=x){
				cout << x << endl;
				break;
			}
			x=y;
		}
			
	} 
}
2024/10/23 22:34
加载中...