30分!!!!!交了无数次求调!
查看原帖
30分!!!!!交了无数次求调!
1220673
shitou612楼主2024/5/21 00:54
#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
int x,a,b,t;
int main()
{
	cin >> t;
	while(t--)
	{
		cin >> x >> a >> b;
		if(a*x-b<0) 
		{
			cout << a*x-b << endl ;
			continue;
		}
		else if(a==0||x==0)
		{
			cout << -b << endl ;
			continue;
		}
		else if(a*x-b==0)
		{
			cout << -b << endl ;
			continue;
		}
		else if(a*x-b>=x||b==0)
		{
			cout << x << endl ;
			continue;
	   	}
	   	else 
	   	{
			while(1)
			{
				x=a*x-b;
				if(x<0)
				{
					cout << x << endl ;
					break;
				}
			}
			continue;
		}
	}
	return 0;
}

2024/5/21 00:54
加载中...