結果

問題 No.1905 PURE PHRASE
ユーザー Akidai16Akidai16
提出日時 2022-08-01 14:50:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,285 bytes
コンパイル時間 4,064 ms
コンパイル使用メモリ 231,052 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-29 09:28:32
合計ジャッジ時間 6,294 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)
#define All(A) A.begin(), A.end()
#define rAll(A) A.rbegin(), A.rend()

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int N;
vi A;

void solve() {
    vector<pair<string, long double>> freqs = {
        {"C4", 261.6}, 
        {"D4", 294.3},
        {"E4", 327.0},
        {"F4", 348.8},
        {"G4", 392.4},
        {"A4", 436.0},
        {"B4", 490.5}
    };
    string ans = "";
    long min_error = LONG_MAX;
    for(pair<string, long double> freq: freqs) {
        long error_sum = 0.0;
        int shift = 44100 / freq.second;
        REP(i, 0, 44100) {
            if(i - shift <= 0) continue;
            error_sum += abs(A[i] - A[i - shift]);
        }
        if(min_error > error_sum) {
            ans = freq.first;
        }
        // cout << error_sum << endl;
    }
    cout << ans << endl;
}

int main() {
    cin >> N;
    A.resize(N);
    REP(i, 0, N) {
        cin >> A[i];
    }
    solve();
}
0