結果
問題 | No.32 貯金箱の憂鬱 |
ユーザー |
|
提出日時 | 2020-08-06 14:21:55 |
言語 | TypeScript (5.7.2) |
結果 |
AC
|
実行時間 | 66 ms / 5,000 ms |
コード長 | 1,064 bytes |
コンパイル時間 | 8,336 ms |
コンパイル使用メモリ | 231,828 KB |
実行使用メモリ | 39,552 KB |
最終ジャッジ日時 | 2024-12-31 16:16:46 |
合計ジャッジ時間 | 9,725 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
import { readFileSync } from 'fs';const getQuotientAndRemainder = ({dividend,divisor,}: {dividend: number;divisor: number;}): { quotient: number; remainder: number } => {return {quotient: Math.floor(dividend / divisor),remainder: dividend % divisor,};};function Main(input: string) {const data = input.split('\n');const beforeHundred = parseInt(data[0]);const beforeQuoter = parseInt(data[1]);const beforeOne = parseInt(data[2]);const sum = beforeOne + beforeQuoter * 25 + beforeHundred * 100;const { quotient: afterThousand } = getQuotientAndRemainder({dividend: sum,divisor: 1000,});const { quotient: afterHundred } = getQuotientAndRemainder({dividend: sum - afterThousand * 1000,divisor: 100,});const {quotient: afterQuoter,remainder: afterOne,} = getQuotientAndRemainder({dividend: sum - afterThousand * 1000 - afterHundred * 100,divisor: 25,});console.log(afterHundred + afterQuoter + afterOne);}Main(readFileSync('/dev/stdin', 'utf8'));