結果
問題 | No.1905 PURE PHRASE |
ユーザー |
![]() |
提出日時 | 2022-04-15 21:29:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 736 bytes |
コンパイル時間 | 4,061 ms |
コンパイル使用メモリ | 254,724 KB |
最終ジャッジ日時 | 2025-01-28 17:55:45 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include <stdio.h>#include <bits/stdc++.h>#include <atcoder/all>using namespace atcoder;using mint = modint998244353;using namespace std;#define rep(i,n) for (int i = 0; i < (n); ++i)#define Inf 1000000001int main(){vector<string> s = {"C4", "D4", "E4", "F4", "G4", "A4", "B4"};vector<double> d = {261.6, 294.3, 327.0, 348.8, 392.4, 436.0, 490.5};int n;cin>>n;vector<int> a(n);rep(i,n)cin>>a[i];int ans = -1;int D = Inf;rep(i,d.size()){int NN = n;NN /= (int)round(d[i]);vector<int> b = a;rep(j,NN){b.push_back(b[0]);b.erase(b.begin());}int sum = 0;rep(j,b.size())sum += abs(b[j] - a[j]);if(D > sum){D = sum;ans = i;}}cout<<s[ans]<<endl;return 0;}