呵呵又是爆零的一天
查看原帖
呵呵又是爆零的一天
1189990
xuanmangguo楼主2024/10/11 12:48
#include<bits/stdc++.h>
using namespace std;
long long n,e,d,q,p,m,i,si;
int main() {
    ios::sync_with_stdio(false);
    cin>>i;
    while(i--) {
        cin>>n>>d>>e;
        m=n-d*e+2;
        i=m*m-4*n;
        si=sqrt(i);
        if(si*si!=i) {
            cout<<"NO"<<endl;
            continue;
        }
        if((m+si)%2==1||m<=si) {
            cout<<"NO"<<endl;
            continue;
        }
        cout<<(m-si)/2<<' '<<(m+si)/2<<endl;
    }
    return 0;
}
2024/10/11 12:48
加载中...