cspj t2 莫名 WA 0
查看原帖
cspj t2 莫名 WA 0
576527
OI_AKed_me楼主2022/10/29 21:36

rt

#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(ll x,ll y){
	ll l=1,r=y-1;
	while(l<=r){
		ll mid=l+r>>1;
		if(mid*(x-mid)==y){
			int ans1=mid,ans2=x-mid;
			cout<<ans1<<' '<<ans2<<endl;
			return ;
		}
		if(mid*x-mid*mid>y){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	cout<<"NO"<<endl;
	return ;
}
void work(){
	ll n,e,d;
	cin>>n>>e>>d;
	solve(n-e*d+2,n);
}
int main(){
	int cas;
	cin>>cas;
	while(cas--){
		work();
	}

	return 0;
}

这题过了就 AK 了,样例又都过了,有大佬帮忙看一下吗

2022/10/29 21:36
加载中...