結果

問題 No.1905 PURE PHRASE
コンテスト
ユーザー Kude
提出日時 2022-04-15 21:55:16
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 263 ms / 2,000 ms
+ 161µs
コード長 500 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 53 ms
コンパイル使用メモリ 14,720 KB
実行使用メモリ 16,092 KB
最終ジャッジ日時 2026-10-20 04:45:39
合計ジャッジ時間 12,628 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge6_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from cmath import exp
from math import tau
n = int(input())
a = list(map(int, input().split()))

mx = 0.0
ans = -1

for i, freq in enumerate([261.6, 294.3, 327.0, 348.8, 392.4, 436.0, 490.5]):
    s = 0
    s += abs(sum(a[t] * exp(- t / n * freq * tau * 1j) for t in range(n)).real)
    r = int(n / freq / 4)
    s += abs(sum(a[(t + r) % n] * exp(- t / n * freq * tau * 1j) for t in range(n)).real)
    if s > mx:
        mx = s
        ans = i

print(['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4'][ans])
0