結果

問題 No.617 Nafmo、買い出しに行く
ユーザー bennkei0327bennkei0327
提出日時 2018-01-12 15:31:39
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 356 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 28,548 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 15:34:49
合計ジャッジ時間 2,054 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,380 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 30 ms
4,380 KB
testcase_06 AC 62 ms
4,376 KB
testcase_07 AC 62 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 45 ms
4,380 KB
testcase_11 AC 54 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,384 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 0 ms
4,380 KB
testcase_19 AC 0 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>

int main(void){

int N,K,A[100000];
int i;
int sum;
int tmp;

scanf("%d %d", &N,&K);

tmp = K;

for(i = 0; i < N; i++){
  scanf("%d",&A[i]);
  }



while(1){
if(tmp == 0){
  break;
}

for(i = 0; i < N ; i++){
  if(tmp == A[i]){
    sum += A[i];
  }
  if(K < sum){
    sum = sum - A[i];
  }
}
tmp--;

}

printf("%d\n",sum);

return 0;

}
0