use strict; use warnings; # https://yukicoder.me/problems/5 # my $input = "7 # 20 # 10 # "; my $input = <>; chomp $input; my $hash_ref; ( $hash_ref->{100}, $hash_ref->{25}, $hash_ref->{1} ) = split /\n/, $input; chomp ($hash_ref->{100}, $hash_ref->{25}, $hash_ref->{1}); my $sum = $hash_ref->{100} * 100 + $hash_ref->{25} * 25 + $hash_ref->{1}; my $coins = $sum % 1000; my $coin_100 = int ($coins / 100); my $coin_25 = int ( ($coins - $coin_100 * 100) / 25); my $coin_1 = int ( ($coins - ($coin_100 * 100 ) - ($coin_25 * 25 ) ) ); print $coin_100 + $coin_25 + $coin_1 ;