結果
問題 |
No.1109 調の判定
|
ユーザー |
![]() |
提出日時 | 2020-07-13 03:41:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 1,569 ms |
コンパイル使用メモリ | 167,756 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-06 18:13:21 |
合計ジャッジ時間 | 2,710 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; #define rep2(i, a, n) for(int i = (a); i < (n); i++) #define rep(i, n) rep2(i,0,n) int main(){ cin.tie(nullptr);ios_base::sync_with_stdio(false); int n;cin>>n; int hoge[n];rep(i,n)cin>>hoge[i]; int shake=-1,d[7]={0,2,4,5,7,9,11},cnt; rep(i,12){ cnt=0; rep(j,n){ rep(k,7){ if(hoge[j]==(i+d[k])%12)cnt++; } } if(cnt==n&&shake==-1){ shake=i; }else if(cnt==n&&shake!=-1){ shake=-1; break; } } cout<<(shake!=-1?shake:-1)<<endl; }