結果

問題 No.1905 PURE PHRASE
ユーザー lloyzlloyz
提出日時 2022-04-15 23:00:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 34,928 KB
最終ジャッジ日時 2023-08-26 08:34:55
合計ジャッジ時間 8,304 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 158 ms
34,472 KB
testcase_01 AC 156 ms
34,324 KB
testcase_02 AC 161 ms
34,400 KB
testcase_03 AC 158 ms
34,292 KB
testcase_04 AC 157 ms
34,628 KB
testcase_05 AC 157 ms
34,804 KB
testcase_06 AC 159 ms
34,736 KB
testcase_07 AC 159 ms
34,824 KB
testcase_08 AC 157 ms
34,624 KB
testcase_09 AC 157 ms
34,928 KB
testcase_10 AC 156 ms
34,828 KB
testcase_11 AC 158 ms
34,392 KB
testcase_12 AC 157 ms
34,696 KB
testcase_13 AC 158 ms
34,844 KB
testcase_14 AC 156 ms
34,376 KB
testcase_15 AC 157 ms
34,388 KB
testcase_16 AC 162 ms
34,372 KB
testcase_17 AC 159 ms
34,280 KB
testcase_18 AC 156 ms
34,828 KB
testcase_19 AC 156 ms
34,384 KB
testcase_20 AC 159 ms
34,800 KB
testcase_21 AC 157 ms
34,412 KB
testcase_22 AC 165 ms
34,700 KB
testcase_23 AC 158 ms
34,384 KB
testcase_24 AC 162 ms
34,884 KB
testcase_25 AC 159 ms
34,520 KB
testcase_26 AC 157 ms
34,484 KB
testcase_27 AC 162 ms
34,740 KB
testcase_28 AC 162 ms
34,380 KB
testcase_29 AC 159 ms
34,516 KB
testcase_30 AC 156 ms
34,496 KB
testcase_31 AC 156 ms
34,512 KB
testcase_32 AC 159 ms
34,836 KB
testcase_33 AC 158 ms
34,356 KB
testcase_34 AC 159 ms
34,732 KB
testcase_35 AC 160 ms
34,604 KB
testcase_36 AC 160 ms
34,688 KB
testcase_37 AC 157 ms
34,388 KB
testcase_38 AC 158 ms
34,780 KB
testcase_39 AC 161 ms
34,516 KB
testcase_40 AC 158 ms
34,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

n = int(input())
A = np.array(list(map(np.float32, input().split())))

A = A / 32768.0
Data = np.fft.fft(A)
Freq = np.fft.fftfreq(Data.shape[0], d=1/n)
Data[(Freq < 250)] = 0.0
Data[(Freq > 500)] = 0.0
idx = np.argmax(Data)
dif = 1000
ans = ''
F = [261.6, 294.3, 327.0, 348.8, 392.4, 436.0, 490.5]
S = ['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4']
p = 1
for i in range(7):
    d = abs(Freq[idx] - F[i])
    if d < dif:
        dif = d
        ans = S[i]
print(ans)
0