結果

問題 No.32 貯金箱の憂鬱
ユーザー a_saikia_saiki
提出日時 2017-06-29 16:44:25
言語 Go
(1.22.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 350 bytes
コンパイル時間 14,369 ms
コンパイル使用メモリ 213,920 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 12:09:05
合計ジャッジ時間 13,877 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,356 KB
testcase_02 AC 1 ms
4,360 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 1 ms
4,356 KB
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 1 ms
4,356 KB
testcase_10 AC 1 ms
4,352 KB
testcase_11 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

func main() {
	var l, m, n int
	fmt.Scanf("%v", &l)
	fmt.Scanf("%v", &m)
	fmt.Scanf("%v", &n)
	sum := l*100 + m*25 + n
	r := map[int]int{1000: 0, 100: 0, 25: 0, 1: 0}
	for _, k := range []int{1000, 100, 25, 1} {
		r[k] = sum / k
		sum = sum - k*r[k]
		if sum < 0 {
			break
		}
	}
	fmt.Printf("%d\n", r[100]+r[25]+r[1])
}
0