求调!!
查看原帖
求调!!
989399
louzezhong20130517楼主2024/4/14 11:41

思路

用数组存好a*x-b的值,然后更新x的值,最后排序,输出。

代码

#include<bits/stdc++.h>
using namespace std;
const long long maxn=1e5+2;
long long c[maxn],i=1;
int main(){
	int t;cin>>t;
	while(t--){
		i++;
		int x,a,b;
		cin>>x>>a>>b;
		c[i]=a*x-b;
		x=c[i];
		sort(c+1,c+i+1);
		cout<<c[i];
	}
	return 0;
}

请帮帮我。

2024/4/14 11:41
加载中...