比赛 |
CSP2022普及组 |
评测结果 |
AAAAAAAAAA |
题目名称 |
解密 |
最终得分 |
100 |
用户昵称 |
遥时_彼方 |
运行时间 |
0.194 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2022-10-29 15:18:57 |
显示代码纯文本
#include<bits/stdc++.h>
#define rep(x,y,z) for(int x=y;x<=z;x++)
#define drep(x,y,z) for(int x=y;x>=z;x--)
#define ull unsigned long long
#define ll long long
using namespace std;
inline ll read()
{
ll x=0;bool flag=1;char ch=getchar();
while(ch<'0'||ch>'9') {if(ch=='-')flag=0;ch=getchar();}
while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
if(flag) return x;
return ~(x-1);
}
inline void write(ll x)
{
if(x<0) {x=~(x-1);putchar('-');}
if(x>9) write(x/10);
putchar(x%10+'0');
}
///////////////////////
int k;
ll n,e,d;
ll p,q;
ll G,g;
inline void solve()
{
n=read(),e=read(),d=read();
g=((e*d-2-n)*(e*d-2-n))-4*n;
if(g<0)
{
cout<<"NO\n";
return;
}
G=sqrt(g);
if(G*G!=g)
{
cout<<"NO\n";
return;
}
q=(G-(e*d-2-n));//(/2)
if(q&1)
{
cout<<"NO\n";
return;
}
q>>=1;
p=n/q;
if(p*q!=n)
{
cout<<"NO\n";
return;
}
if(p>q) swap(p,q);
write(p),putchar(32),write(q),putchar(10);
}
int main()
{
freopen("csp2022pj_decode.in","r",stdin);
freopen("csp2022pj_decode.out","w",stdout);
k=read();
for(int i=1;i<=k;i++) solve();
return 0;
}