結果
| 問題 |
No.587 七対子
|
| コンテスト | |
| ユーザー |
@abcde
|
| 提出日時 | 2019-02-24 12:56:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 650 bytes |
| コンパイル時間 | 1,155 ms |
| コンパイル使用メモリ | 165,204 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 19:58:05 |
| 合計ジャッジ時間 | 2,022 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
// 1. 入力情報取得.
string S;
cin >> S;
// 2. 異なる7つの文字のペアに出来るか?.
// 2回出現する文字 … 6個, 1回出現する文字 … 1個 であるかを確認.
map<char, int> m;
for(int i = 0; i < S[i]; i++) m[S[i]]++;
int one = 0, two = 0;
string ans;
for(auto &p : m){
if(p.second == 1) one++, ans = p.first;
if(p.second == 2) two++;
}
// 3. 終了.
if(one == 1 && two == 6) cout << ans << endl;
else cout << "Impossible" << endl;
return 0;
}
@abcde