結果

問題 No.1905 PURE PHRASE
ユーザー nyst
提出日時 2022-04-15 22:58:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,191 bytes
コンパイル時間 1,077 ms
コンパイル使用メモリ 102,428 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 02:09:02
合計ジャッジ時間 2,958 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    long long maxv=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(maxv < a[i]) maxv = a[i];
    }
    maxv = maxv/2;

    for(int i=0;i<n;i++) {
        if(0< i-10 && c==0 && a[i-1] < maxv && maxv < a[i]) {
            left = i;
            c++;
            continue;
        }
        if(0 <i-10 && c==1 && a[i-1] < maxv  && maxv <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;

}
0