結果

問題 No.32 貯金箱の憂鬱
ユーザー vabuffvabuff
提出日時 2018-01-17 22:27:24
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 887 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 42,512 KB
最終ジャッジ日時 2023-09-30 13:02:39
合計ジャッジ時間 2,106 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
42,344 KB
testcase_01 AC 81 ms
42,272 KB
testcase_02 AC 82 ms
42,428 KB
testcase_03 AC 86 ms
42,276 KB
testcase_04 AC 82 ms
42,448 KB
testcase_05 AC 82 ms
42,384 KB
testcase_06 AC 79 ms
42,300 KB
testcase_07 AC 82 ms
42,460 KB
testcase_08 AC 84 ms
42,464 KB
testcase_09 AC 83 ms
42,252 KB
testcase_10 AC 79 ms
42,296 KB
testcase_11 AC 79 ms
42,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* eslint no-console: "off" */

let assert = require("assert");

function tokens(s) {
    return s.trim().split(/\s+/);
}

function div_ceil(a, b) {
    return Math.trunc(a/b) + ((((a<0)^(b>0)) && a%b) ? 1 : 0);
}

function div_floor(a, b) {
    return Math.trunc(a/b) + ((((a>0)^(b>0)) && a%b) ? 1 : 0);
}

function digits(n) {
    assert(n >= 0);

    if(n == 0) return [0];

    let res = [];
    while(n > 0) {
        res.push(n % 10);
        n = div_floor(n, 10);
    }
    return res;
}

function TO_INT(s) {
    return parseInt(s, 10);
}

function Main(input) {
    let [L, M, N] = tokens(input).map(s => TO_INT(s));

    let ans = 0;

    let val = 100*L + 25*M + N;
    val %= 1000;

    ans += div_floor(val, 100);
    val %= 100;
    ans += div_floor(val, 25);
    val %= 25;
    ans += val;

    console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0