結果

問題 No.1686 Geschenkt
ユーザー LV3zJigVW57oPGyLV3zJigVW57oPGy
提出日時 2022-08-17 14:14:05
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 371 bytes
コンパイル時間 1,324 ms
コンパイル使用メモリ 163,668 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 04:24:20
合計ジャッジ時間 1,939 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
6,940 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 WA -
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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