QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#671763 | #9381. 502 Bad Gateway | wjh111 | TL | 10ms | 10820kb | Python3 | 396b | 2024-10-24 14:22:06 | 2024-10-24 14:22:06 |
Judging History
answer
import math as m
t=int(input())
for i in range(t):
n=int(input())
w=int(m.sqrt(2*n))
w1=w+1
u=w*w-w+2*n
k=2*w
p=m.gcd(u,k)
u=u//p
k=k//p
if ((w*w)==(2*n)):
print(u,k)
continue
u1=w1*w1-w1+2*n
k1=2*w1
p=m.gcd(u1,k1)
u1=u1//p
k1=k1//p
if (u*k1>u1*k):
print(u,k)
else:
print(u1,k1)
詳細信息
Test #1:
score: 100
Accepted
time: 10ms
memory: 10820kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Time Limit Exceeded
input:
1000000 1 1000000000 1 1 1000000000 1 1000000000 1 1 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1 1 1000000000 1 1000000000 1000000000 1000000000 1000000000 1 1 1 10000000...
output:
1 1 2000006281 44722 1 1 1 1 2000006281 44722 1 1 2000006281 44722 1 1 1 1 1 1 2000006281 44722 1 1 1 1 2000006281 44722 1 1 2000006281 44722 2000006281 44722 1 1 2000006281 44722 1 1 1 1 2000006281 44722 1 1 2000006281 44722 2000006281 44722 1 1 2000006281 44722 2000006281 44722 2000006281 44722 20...