QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#742200#3135. Mining avwxyz#AC ✓18ms10716kbPython3592b2024-11-13 16:03:522024-11-13 16:03:58

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 16:03:58]
  • 评测
  • 测评结果:AC
  • 用时:18ms
  • 内存:10716kb
  • [2024-11-13 16:03:52]
  • 提交

answer

from collections import defaultdict

T=int(input())
for t in range(T):
    N=int(input())
    F=defaultdict(int)
    NN=N
    for p in range(2,N+1):
        if p*p>N:
            break
        while NN%p==0:
            NN//=p
            F[p]+=1
    if NN>1:
        F[NN]+=1
    D=[1]
    for p in F:
        F[p]*=2
        e=F[p]
        prev=D
        D=[]
        for d in prev:
            for c in range(e+1):
                D.append(d*p**c)
    ans=0
    for b in D:
        ab=N*N//b
        b+=N
        ab+=N
        ans=max(ans,ab^b)
    print(ans)

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 14ms
memory: 10520kb

input:

3
6
7
10

output:

45
48
101

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 9ms
memory: 10624kb

input:

3
1
2
7777777

output:

0
5
60493819864864

result:

ok 3 lines

Test #3:

score: 0
Accepted
time: 18ms
memory: 10716kb

input:

20
5352
7774
898767
9999999
2019102
10000000
3424123
8998231
1234
1241564
8888959
5411738
200000
2345235
9902352
9092342
2909525
9090909
4532423
9191991

output:

28652481
60446397
807782253792
99999983156992
4076773743037
100000017825793
11724620970984
80968179092912
1525189
1541483271985
79013592252160
29286916841381
40000131073
5500131830120
98056577753857
82670700086701
8465341544152
82644644558968
20542867168176
84492699625520

result:

ok 20 lines