結果

問題 No.1905 PURE PHRASE
ユーザー cologne
提出日時 2022-04-16 11:34:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 15,592 KB
最終ジャッジ日時 2024-12-25 16:04:05
合計ジャッジ時間 8,996 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

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