結果
問題 |
No.587 七対子
|
ユーザー |
![]() |
提出日時 | 2023-08-18 14:33:10 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 583 bytes |
コンパイル時間 | 859 ms |
コンパイル使用メモリ | 106,316 KB |
最終ジャッジ日時 | 2025-02-16 09:05:02 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 35 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:24:25: warning: ‘p’ may be used uninitialized [-Wmaybe-uninitialized] 24 | if (v[i] == 2) p++; | ~^~ main.cpp:18:9: note: ‘p’ was declared here 18 | int p, ans = 0, cnt = 0; | ^
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<cctype> #include<set> #include<bitset> #include<math.h> #include<map> #include<queue> #include<iomanip> using namespace std; #ifdef _WIN32 #include <Windows.h> #endif int main() { int p, ans = 0, cnt = 0; string s; cin >> s; vector<int> v(26, 0); for (int i = 0; i < s.size(); i++) v[s[i] - 'a']++; for (int i = 0; i < 26; i++){ if (v[i] == 2) p++; if (v[i] == 1) ans = i; } if (p == 6 && ans) cout << char('a' + ans) << endl; else cout << "Imposseoble" << endl; }