結果
| 問題 | No.587 七対子 | 
| コンテスト | |
| ユーザー |  ninoinui | 
| 提出日時 | 2020-02-14 02:23:17 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 336 bytes | 
| コンパイル時間 | 1,698 ms | 
| コンパイル使用メモリ | 168,284 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-19 20:03:25 | 
| 合計ジャッジ時間 | 2,871 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 35 | 
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:13:38: warning: 'z' may be used uninitialized [-Wmaybe-uninitialized]
   13 |   if (x == 1 && !y) cout << char('a' + z) << "\n";
      |                                  ~~~~^~~
main.cpp:8:21: note: 'z' was declared here
    8 |   int x = 0, y = 0, z;
      |                     ^
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> V(26);
  char C;
  while (cin >> C) V.at(C - 'a')++;
  int x = 0, y = 0, z;
  for (int i = 0; i < 26; i++) {
    if (V.at(i) == 1) x++, z = i;
    if (V.at(i) > 2) y++;
  }
  if (x == 1 && !y) cout << char('a' + z) << "\n";
  else cout << "Impossible" << "\n";
}
            
            
            
        