60分求助,8个测试点超时
  • 板块题目总版
  • 楼主kun_han
  • 当前回复4
  • 已保存回复4
  • 发布时间2023/8/20 10:00
  • 上次更新2023/11/3 02:31:37
查看原帖
60分求助,8个测试点超时
948027
kun_han楼主2023/8/20 10:00
#include<bits/stdc++.h>
using namespace std;
int k;
struct st{
	long long a,b,c;
}x[100010];
int g,h;
bool d=false;
int main(){
	cin>>k;
	for(int i=1;i<=k;i++){
		cin>>x[i].a>>x[i].b>>x[i].c;
	}
	for(int i=1;i<=k;i++){
		for(int j=1;j<=sqrt(x[i].a);j++){
			int l=x[i].a/j;
			if(j*l==x[i].a&&j+l==x[i].a-x[i].b*x[i].c+2){
				g=j,h=l;
				d=true;
				break;
			}
		}
		if(d==true){
			cout<<g<<" "<<h<<endl;
		}else{
			cout<<"NO"<<endl;
		}
		d=false;
	}
} 
2023/8/20 10:00
加载中...