結果
問題 |
No.1905 PURE PHRASE
|
ユーザー |
|
提出日時 | 2022-04-15 22:36:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 986 bytes |
コンパイル時間 | 848 ms |
コンパイル使用メモリ | 103,244 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-25 01:35:58 |
合計ジャッジ時間 | 2,481 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 8 WA * 30 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <map> #include <set> #include <fstream> #include <cmath> #include <stack> #include <queue> #include <iomanip> #include <bitset> using namespace std; int main(){ int n;cin>>n; vector<long long> a(n); int c = 0; int left = 0; int right = 0; for(int i=0;i<n;i++) { cin >> a[i]; if(c==0 && a[i-1]<0 && 0<a[i]) { left = i; c++; } if(c==1 && a[i-1]<0 && 0<a[i]){ right = i; c++; } } double diff = right - left; double f = 44100 / diff; vector<double> flist{261.6,294.3,327.0,348.8}; vector<string> list{"C4","D4","E4","F4","G4","A4","B4"}; double minv = 10000000000000; int ans = 0; for(int i = 0;i<flist.size();i++){ if(abs(flist[i]-f) < minv){ minv = abs(flist[i]-f); ans = i; } } cout << list[ans] << endl; }