結果
問題 | No.587 七対子 |
ユーザー |
|
提出日時 | 2019-07-31 18:41:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 393 bytes |
コンパイル時間 | 2,179 ms |
コンパイル使用メモリ | 193,788 KB |
最終ジャッジ日時 | 2025-01-07 10:18:19 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:16:27: warning: ‘one’ may be used uninitialized [-Wmaybe-uninitialized] 16 | if (two == 6) cout << one << endl; | ^~~ main.cpp:11:10: note: ‘one’ was declared here 11 | char one; | ^~~
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int cnt[256] {}; string s; cin >> s; for (char c : s) cnt[c]++; int two = 0; char one; for (char c = 'a'; c <= 'z'; c++) { if (cnt[c] == 2) two++; else if (cnt[c] == 1) one = c; } if (two == 6) cout << one << endl; else puts("Impossible"); return 0; }