結果

問題 No.587 七対子
ユーザー ajiruajiru
提出日時 2020-02-05 11:25:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 1,237 ms
コンパイル使用メモリ 75,776 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 20:03:04
合計ジャッジ時間 1,528 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;
int main(void) {
	string s;
	cin >> s;
	map<char, int> mp;
	for (int i = 0; i < 13; ++i) {
		++mp[s[i]];
	}
	bool ok = true;
	char ans = ' ';
	if (mp.size() != 7) ok = false;
	else {
		for (auto x : mp) {
			if (x.second != 1 && x.second != 2) {
				ok = false;
				break;
			}
			if (x.second == 1)
				ans = x.first;
		}
	}
	if (ok) cout << ans << endl;
	else cout << "Impossible" << endl;
	return 0;
}
0