QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#507226#5253. Denormalizationucup-team1525#WA 100ms11024kbPython3854b2024-08-06 14:01:592024-08-06 14:02:00

Judging History

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

  • [2024-08-06 14:02:00]
  • 评测
  • 测评结果:WA
  • 用时:100ms
  • 内存:11024kb
  • [2024-08-06 14:01:59]
  • 提交

answer

import math
from copy import deepcopy


# check norm
def check_norm(D, ans):
    n = len(D)
    norm_ans = math.sqrt(sum([x**2 for x in ans]))
    for i in range(n):
        if math.fabs(ans[i] / norm_ans - D[i]) > 1e-6:
            return False
        if ans[i] > 10000:
            return False
    return True
    

n = int(input())
D = []

for i in range(n):
    x = float(input())
    D.append(x)
    
D2 = deepcopy(D)

mn = min(D)
for i in range(n):
    D[i] /= mn

for K in range(1, 20001):
    A = []
    for i in range(n):
        A.append(int(D[i] * K))

    gcd = A[0]
    for i in range(1, n):
        gcd = math.gcd(gcd, A[i])
        
    for i in range(n):
        A[i] //= gcd
        
    if (check_norm(D2, A)):
        for x in A:
            print(x)
        exit(0)

assert(False)



详细

Test #1:

score: 100
Accepted
time: 7ms
memory: 10908kb

input:

2
0.909840249060
0.414958698174

output:

1423
649

result:

ok good solution

Test #2:

score: 0
Accepted
time: 15ms
memory: 11024kb

input:

3
0.005731604132
0.696198848562
0.717826101486

output:

22
2672
2755

result:

ok good solution

Test #3:

score: -100
Wrong Answer
time: 100ms
memory: 10928kb

input:

10
0.338936215010
0.390914583549
0.048893426174
0.446152513833
0.137891103101
0.017985796057
0.459132554353
0.201452557127
0.362800863500
0.358493585479

output:


result:

wrong output format Unexpected end of file - int32 expected