TLE 50pts求调
查看原帖
TLE 50pts求调
340667
OverskidExMonikium楼主2024/9/26 20:56
// Problem: P8814 [CSP-J 2022] 解密
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P8814
// Memory Limit: 512 MB
// Time Limit: 1000 ms

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull k,n,e,d;
int main(){
	cin >> k;
	for(int i=0;i<k;i++){
		cin >> n >> e >> d;
		for(ull q=(2+n-e*d)/2;q<=(2+n-e*d)/2;q--){
			ull p=(2+n-e*d)-q;
			if(p*q==n){
				cout << q << " " << p << endl;
				goto b;
			}
		}
		cout << "NO" << endl;
		b:
		{}
	}
}
2024/9/26 20:56
加载中...