結果
問題 |
No.128 お年玉(1)
|
ユーザー |
![]() |
提出日時 | 2021-02-14 11:58:20 |
言語 | TypeScript (5.7.2) |
結果 |
AC
|
実行時間 | 65 ms / 5,000 ms |
コード長 | 651 bytes |
コンパイル時間 | 8,227 ms |
コンパイル使用メモリ | 229,096 KB |
実行使用メモリ | 39,552 KB |
最終ジャッジ日時 | 2024-12-31 16:25:33 |
合計ジャッジ時間 | 10,566 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
import * as fs from 'fs'; const input = fs.readFileSync('/dev/stdin', 'utf8'); const arr = input.split(/[ \n]/); let N = parseInt(arr[0]); let M = parseInt(arr[1]); //何円あげられるか let result = N / M; //1000円札何枚あげられるか let answer = 0; if (result % 1000 === 0) { //resultがそのままあげられる金額になる answer = result; } else { //resultの中で1000円を何枚あげられるか計算して、1000未満の端数を消す Math.floor(result / 1000); //求めた枚数に1000円をかけてあげる金額にする answer = 1000 * Math.floor(result / 1000); } console.log(answer);