結果

問題 No.1905 PURE PHRASE
ユーザー abc3
提出日時 2022-04-16 00:18:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 1,167 bytes
コンパイル時間 2,263 ms
コンパイル使用メモリ 199,556 KB
最終ジャッジ日時 2025-01-28 18:45:48
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

   #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)

    typedef long long ll;
    typedef unsigned long long ull;
    using P=pair<ll,ll>;
    using tp=tuple<ll,ll,ll>;
    const int INF=1001001001;
    const ll INFL=1e18;
    const int mod=1e9+7;

    void solve(){
		int n;
		cin>>n;
		vector<int>a(n);
		rep(i,n)cin>>a[i];
		vector<double>t={261.6, 294.3, 327.0, 348.8, 392.4, 436.0, 490.5};
        vector<string>s={"C4","D4","E4","F4","G4","A4","B4"}; 
		double mn=INF;
		string ans;
		rep(i,7){
			int k=n*1ll/t[i];
			double d=0;
			rep(j,k){
				d+=abs(a[j]-a[j+k]);
			}
			if(chmin(mn,d)){
                ans=s[i];
			}
		}
		cout<<ans<<endl;
    }  

    int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        
        solve();
        
        return 0;
    }
0