結果

問題 No.32 貯金箱の憂鬱
ユーザー akuto1125akuto1125
提出日時 2018-10-04 00:45:29
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 466 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 42,192 KB
最終ジャッジ日時 2023-09-30 13:15:34
合計ジャッジ時間 2,316 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
42,188 KB
testcase_01 AC 74 ms
42,180 KB
testcase_02 AC 74 ms
42,144 KB
testcase_03 AC 76 ms
42,148 KB
testcase_04 AC 75 ms
42,128 KB
testcase_05 AC 75 ms
42,100 KB
testcase_06 AC 76 ms
42,096 KB
testcase_07 AC 76 ms
42,096 KB
testcase_08 AC 75 ms
42,136 KB
testcase_09 AC 75 ms
42,108 KB
testcase_10 AC 75 ms
42,192 KB
testcase_11 AC 74 ms
42,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
  input = input.split('\n');
  input.unshift(0);

  for(var i = 0; i < input.length; i++) {
    input[i] = parseInt(input[i]);
  }

  function exchange(num, val) {
    if (input[num] >= val) {
      input[num - 1] += Math.floor(input[num] / val);
      input[num] %= val;
    }
  }
  exchange(3, 25);
  exchange(2, 4);
  exchange(1, 10);

  console.log(input[1] + input[2] + input[3]);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
0