QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#737333 | #9622. 有限小数 | UESTC_NLNS | Compile Error | / | / | C++20 | 468b | 2024-11-12 15:31:14 | 2024-11-12 15:31:15 |
Judging History
answer
a=[2**i for i in range(40)]
b=[5**i for i in range(40)]
V=[i*j for i in a for j in b]
inf=1e9
V.sort()
t=int(input())
for i in range(t):
a,b=map(int, input().split())
as1=as2=inf
T=1
while b%2==0:
T*=2
b//=2
while b%5==0:
T*=5
b//=5
iT=pow(T,-1,b)
for v in V:
if b*v>inf:break
d=b*v
c=(-a*v*iT) % b
if c<as1:
as1,as2=c,d
print(as1,as2)
Details
answer.code:1:1: error: ‘a’ does not name a type 1 | a=[2**i for i in range(40)] | ^