結果
| 問題 | 
                            No.1905 PURE PHRASE
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Kude
                         | 
                    
| 提出日時 | 2022-04-15 21:55:16 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 394 ms / 2,000 ms | 
| コード長 | 500 bytes | 
| コンパイル時間 | 388 ms | 
| コンパイル使用メモリ | 12,416 KB | 
| 実行使用メモリ | 15,464 KB | 
| 最終ジャッジ日時 | 2024-12-25 00:30:42 | 
| 合計ジャッジ時間 | 18,042 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 38 | 
ソースコード
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])
            
            
            
        
            
Kude