数学40分求助
查看原帖
数学40分求助
809915
Octovolib楼主2022/10/29 16:23

样例都过了为什么40分 T_T code

#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
long long k;
long long n,e,d,p,q;
int main(){
	scanf("%lld",&k);
	while(k--){
		
		scanf("%lld%lld%lld",&n,&e,&d);
		
		long long m=n-e*d+2,delta=(n-e*d+2)*(n-e*d+2)-4*n;
		
		long long sdel=sqrt(delta);
		
		if(delta<0){
			puts("NO");
			continue;
		}
		else if((m-sdel)%2!=0){
			puts("NO");
			continue;
		}
		else {
			p=(m-sdel)/2,q=(m+sdel)/2; 
		}
		printf("%lld %lld\n",p,q);
	}
	return 0;
}
2022/10/29 16:23
加载中...