結果

問題 No.1686 Geschenkt
ユーザー LV3zJigVW57oPGyLV3zJigVW57oPGy
提出日時 2022-08-17 13:59:50
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 332 bytes
コンパイル時間 1,642 ms
コンパイル使用メモリ 162,036 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 04:16:38
合計ジャッジ時間 2,265 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 RE -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:22: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |   cout << vec.at(0) +b;
      |                      ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a;
  cin >>a;
  int b, c;
  vector<int> vec(a);
  for(int  i=0; i<a; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  for(int i=1; i<a; i++){
    if(vec.at(i+1) - 1 != vec.at(i)){
     b = vec.at(i+1);
      break;
    }
  }
  cout << vec.at(0) +b;
}
0