結果
| 問題 |
No.32 貯金箱の憂鬱
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-23 12:27:22 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 5,000 ms |
| コード長 | 656 bytes |
| コンパイル時間 | 30 ms |
| コンパイル使用メモリ | 6,692 KB |
| 実行使用メモリ | 41,084 KB |
| 最終ジャッジ日時 | 2024-07-23 07:59:32 |
| 合計ジャッジ時間 | 1,499 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
function main(input = '') {
if (!input) throw Error;
let lines = input.split('\n');
let [num100, num25, num1] = lines.map((val) => parseInt(val));
let moneyAccount = num100 * 100 + num25 * 25 + num1;
let numCoins = 0;
moneyAccount %= 1000;
numCoins += Math.floor(moneyAccount / 100);
moneyAccount %= 100;
numCoins += Math.floor(moneyAccount / 25);
moneyAccount %= 25;
numCoins += moneyAccount;
return `${numCoins}`;
}
const { readFileSync, existsSync } = require('fs');
const stdin = '/dev/stdin';
if (existsSync(stdin)) {
const input = readFileSync(stdin, 'utf8');
console.log(main(input));
}
module.exports = main;