結果

問題 No.1905 PURE PHRASE
ユーザー nystnyst
提出日時 2022-04-15 22:40:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,016 bytes
コンパイル時間 854 ms
コンパイル使用メモリ 100,328 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 08:21:44
合計ジャッジ時間 2,643 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 11 ms
4,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 12 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 12 ms
4,376 KB
testcase_14 WA -
testcase_15 AC 11 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 12 ms
4,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 11 ms
4,380 KB
testcase_28 WA -
testcase_29 AC 10 ms
4,380 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 11 ms
4,376 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

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;
    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;

}
0