求调,不知道哪里错了是编译错误
查看原帖
求调,不知道哪里错了是编译错误
1210641
wuxiaomi0103楼主2024/10/21 13:29
#include<bits/stdc++.h>
using namespace std;
int main(){
    freopen("decode.in","r",stdin);
    freopen("decode.out","w",stdout);
    long long t,n,d,e;
    cin>>t;
    while(t--){
        cin>>n>>d>>e;
        long long s=(n-e*d+2)*(n-d*e)-4*n;
        if(s<0){
			cout<<"NO"<<endl;
            continue;
        }
        long long p=1.0*((n-e*d+2)-sqrt(s))/2;
        long long q=1.0*((n-e*d+2)-sqrt(s))/2;
        if(p>0&&q>0&&(e*d==(p−1)*(q−1)+1)&&(n==p*q){
            cout<<p<<" "<<q<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
}
2024/10/21 13:29
加载中...