結果
| 問題 |
No.587 七対子
|
| コンテスト | |
| ユーザー |
Yut176
|
| 提出日時 | 2019-05-18 03:12:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 634 bytes |
| コンパイル時間 | 863 ms |
| コンパイル使用メモリ | 89,580 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 19:59:02 |
| 合計ジャッジ時間 | 1,880 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:32:32: warning: 'c' may be used uninitialized [-Wmaybe-uninitialized]
32 | if(x == 1 && y == 6) cout << c << endl;
| ^
main.cpp:23:8: note: 'c' was declared here
23 | char c;
| ^
ソースコード
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int main(void) {
string s; cin >> s;
map<char, int> m;
for(int i=0; i<s.size(); i++) {
m[s[i]]++;
}
int x = 0;
int y = 0;
char c;
for(auto i=m.begin(); i!=m.end(); i++) {
if(i->second == 1) {
x++;
c = i->first;
} else if(i->second == 2) {
y++;
}
}
if(x == 1 && y == 6) cout << c << endl;
else cout << "Impossible" << endl;
return 0;
}
// EOF
Yut176