結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,380 KB
testcase_01 AC 1 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,380 KB
testcase_07 AC 62 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 44 ms
4,380 KB
testcase_11 AC 53 ms
4,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 0 ms
4,376 KB
testcase_18 AC 0 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 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