看不出错误
查看原帖
看不出错误
1145602
dongzhenmao楼主2024/5/25 06:55
#include <ctype.h>
#include <wchar.h>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#define lnt long long
using namespace std;
char ff,chh;lnt xx;lnt read(){
    xx=ff=0;while(!isdigit(chh)){if(chh=='-'){ff=1;}chh=getchar();}
    while(isdigit(chh)){xx=(xx<<1)+(xx<<3)+chh-'0';chh=getchar();}return xx;
}
const int N=1e9;
lnt G,n,e,d,p,q;
lnt a,fb,pd;
void init();
int main(){
    //init();
    G=read();
    while(G--){
		n=read();e=read();d=read();
		fb=n+2-e*d;
		pd=(fb*fb)-4*n;
		lnt pdf=llabs(sqrtl(pd));
		if(pdf*pdf==pd){
			p=fb-pdf;
			q=fb+pdf;if(p%2==1 || p==0 || q==0){puts("No");continue;}
			p>>=1;q>>=1;
			printf("%lld %lld\n",p,q);
		}
		else{puts("No");}
	}
    
    return 0;
}
void init(){
    freopen("decode.in","r",stdin);
    freopen("decode.out","w",stdout);
}
2024/5/25 06:55
加载中...