結果
問題 | No.587 七対子 |
ユーザー |
![]() |
提出日時 | 2018-01-16 12:01:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 805 bytes |
コンパイル時間 | 683 ms |
コンパイル使用メモリ | 78,852 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 19:49:52 |
合計ジャッジ時間 | 1,735 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:34:22: warning: 'idx' may be used uninitialized [-Wmaybe-uninitialized] 34 | char c = 'a' + idx; | ~~~~^~~~~ main.cpp:24:23: note: 'idx' was declared here 24 | int o = 0, t = 0, idx; | ^~~
ソースコード
#include <iostream> #include <math.h> #include <algorithm> #include <functional> #include <vector> #include <typeinfo> #include <climits> #include <ctype.h> #include <string> #include <stack> using namespace std; #define FOR(i, a, n) for (int i = a; i < n; i++) #define REP(i, n) for(int i = 0; i < n; i++) struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star; int main(){ string s; cin >> s; int A[26] = {}; REP(i, s.size()){ A[s[i] - 97]++; } int o = 0, t = 0, idx; REP(i, 26){ if(A[i] == 1){ o++; if(o > 1) break; idx = i; } else if(A[i] == 2) t++; } if(o == 1 and t == 6){ char c = 'a' + idx; cout << c << endl; }else cout << "Impossible" << endl; return 0; }