結果
問題 |
No.1905 PURE PHRASE
|
ユーザー |
|
提出日時 | 2022-04-15 22:40:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,016 bytes |
コンパイル時間 | 1,225 ms |
コンパイル使用メモリ | 102,172 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 01:45:48 |
合計ジャッジ時間 | 3,124 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 s = diff * 1/(double)44100; double f = 1/s; 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; }