結果

問題 No.1046 Fruits Rush
ユーザー Haar
提出日時 2020-05-08 21:26:43
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 294 bytes
コンパイル時間 2,547 ms
コンパイル使用メモリ 192,756 KB
最終ジャッジ日時 2025-01-10 08:02:01
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 3 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main(){
  int n, k; std::cin >> n >> k;
  std::vector<int> a(n);
  for(int i = 0; i < n; ++i){
    std::cin >> a[i];
  }

  int ans = a[0];
  for(int i = 1; i < k; ++i){
    if(a[i] >= 0){
      ans += a[i];
    }
  }  

  std::cout << ans << "\n";

  return 0;
}
0