結果
問題 | No.587 七対子 |
ユーザー |
![]() |
提出日時 | 2018-08-08 09:29:37 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 636 bytes |
コンパイル時間 | 680 ms |
コンパイル使用メモリ | 76,864 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 19:54:28 |
合計ジャッジ時間 | 1,401 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<functional> #include<vector> #include<set> #include<queue> #include<list> #include<stdio.h> #include<stdlib.h> #include<map> using namespace std; int main() { string s; cin >> s; map<char, int> data; for (int i = 0; i < s.length(); ++i) { ++data[s[i]]; } map<char, int>::iterator itr; char one = -1; int two = 0; for (auto itr = data.begin(); itr != data.end(); ++itr) { if (itr->second==1) { one = itr->first; } else if (itr->second==2) { ++two; } } if (two == 6 && one != -1) { cout << one; } else { cout << "Impossible"; } }