結果

問題 No.1905 PURE PHRASE
コンテスト
ユーザー cologne
提出日時 2022-04-16 11:34:50
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 575 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 470 ms
コンパイル使用メモリ 20,964 KB
実行使用メモリ 18,748 KB
最終ジャッジ日時 2026-05-31 08:49:52
合計ジャッジ時間 9,676 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import math
import cmath


def main():
    N = int(input())
    *A, = map(int, input().split())

    melody = [
        ("C4", 261.6),
        ("D4", 294.3),
        ("E4", 327.0),
        ("F4", 348.8),
        ("G4", 392.4),
        ("A4", 436.0),
        ("B4", 490.5),
    ]

    ans = 0
    ansv = 0

    for m, f in melody:
        angle = 2*math.pi*f/N
        s = 0
        for i in range(N):
            s += A[i] * cmath.exp(angle*i*1j)
        if ans < abs(s):
            ans = abs(s)
            ansv = m

    print(ansv)


if __name__ == '__main__':
    main()
0