結果

問題 No.481 1から10
コンテスト
ユーザー tenman
提出日時 2017-09-04 18:32:26
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 318µs
コード長 320 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 257 ms
コンパイル使用メモリ 71,356 KB
実行使用メモリ 9,932 KB
最終ジャッジ日時 2026-09-19 20:13:48
合計ジャッジ時間 1,248 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:18:11: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   18 |   cout << ans << endl;
      |           ^~~
main.cpp:12:7: note: 'ans' was declared here
   12 |   int ans;
      |       ^~~

ソースコード

diff #
raw source code

#include <iostream>
using namespace std;

bool used[10];

int main() {
  // 入力
  int a[9];
  for (int i = 0; i < 9; i++) cin >> a[i];

  for (int i = 0; i < 9; i++) used[a[i]-1] = true;
  int ans;
  for (int i = 0; i < 10; i++) {
    if (!used[i]) ans = i + 1;
  }

  // 解答
  cout << ans << endl;

  return 0;
}
0