結果

問題 No.143 豆
ユーザー togaerrortogaerror
提出日時 2015-03-17 22:27:16
言語 Perl
(5.38.0)
結果
AC  
実行時間 5 ms / 1,000 ms
コード長 304 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 5,108 KB
最終ジャッジ日時 2023-09-30 16:32:03
合計ジャッジ時間 1,054 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,936 KB
testcase_01 AC 5 ms
5,092 KB
testcase_02 AC 5 ms
5,000 KB
testcase_03 AC 5 ms
4,996 KB
testcase_04 AC 5 ms
5,108 KB
testcase_05 AC 5 ms
5,096 KB
testcase_06 AC 5 ms
4,996 KB
testcase_07 AC 5 ms
4,916 KB
testcase_08 AC 5 ms
5,048 KB
testcase_09 AC 5 ms
4,780 KB
testcase_10 AC 5 ms
4,936 KB
testcase_11 AC 5 ms
5,040 KB
testcase_12 AC 5 ms
4,812 KB
testcase_13 AC 5 ms
5,100 KB
testcase_14 AC 5 ms
4,924 KB
testcase_15 AC 5 ms
4,804 KB
testcase_16 AC 5 ms
4,924 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/perl

use warnings;
use strict;

my ($k, $n, $f) = split / /, <>;
my $year = <>;
chomp $year;
my @array = split / /, $year;
my $total = 0;

for(my $i = 0; $i < $f; $i++) {
	$total += $array[$i]; 
}

my $ans = $k * $n - $total;

if($ans < 0) {
	print "-1\n";
} else {
	print "$ans\n";
}

exit;
0