結果

問題 No.1109 調の判定
ユーザー kotatsugame
提出日時 2020-07-10 21:26:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 682 ms
コンパイル使用メモリ 77,216 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 07:40:04
合計ジャッジ時間 1,906 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<set>
using namespace std;
int N,T[12];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>T[i];
	vector<int>ans;
	set<int>tmp={0,2,4,5,7,9,11};
	for(int D=0;D<12;D++)
	{
		bool ok=true;
		for(int i=0;i<N;i++)
		{
			if(tmp.find((T[i]-D+12)%12)==tmp.end())ok=false;
		}
		if(ok)ans.push_back(D);
	}
	if(ans.size()==1)cout<<ans[0]<<endl;
	else cout<<-1<<endl;
}
0