結果

問題 No.311 z in FizzBuzzString
ユーザー tsubaki961tsubaki961
提出日時 2016-05-21 22:06:21
言語 Perl
(5.38.2)
結果
MLE  
実行時間 -
コード長 697 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 5,788 KB
実行使用メモリ 816,372 KB
最終ジャッジ日時 2023-10-25 02:44:29
合計ジャッジ時間 2,027 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,772 KB
testcase_01 AC 4 ms
5,808 KB
testcase_02 AC 4 ms
5,840 KB
testcase_03 AC 4 ms
5,908 KB
testcase_04 AC 5 ms
5,908 KB
testcase_05 AC 6 ms
6,992 KB
testcase_06 AC 7 ms
7,364 KB
testcase_07 MLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Scalar value @box[0] better written as $box[0] at Main.pl line 30.
Scalar value @box[0] better written as $box[0] at Main.pl line 31.
Scalar value @box[1] better written as $box[1] at Main.pl line 32.
Scalar value @box[0] better written as $box[0] at Main.pl line 33.
Scalar value @box[0] better written as $box[0] at Main.pl line 38.
Scalar value @box[...] better written as $box[...] at Main.pl line 39.
Scalar value @box[...] better written as $box[...] at Main.pl line 39.
Scalar value @box[...] better written as $box[...] at Main.pl line 40.
Scalar value @count[...] better written as $count[...] at Main.pl line 5.
Main.pl syntax OK

ソースコード

diff #

use strict;

my $N = <STDIN>;
my @count = Fire($N);
for(my $i = @count - 1; $i >= 0; $i--){
	print @count[$i];
}
print "\n";

sub Fire
{
	my @box;
	my $set = 0;
	my $N = $_[0];
	if($N % 3 == 0 && $N % 5 == 0)
	{
		$set = 4;
	}elsif($N % 3 == 0){
		$set = 2;
	}elsif($N % 5 == 0){
		$set = 2;
	}else{
		$set = 0;
	}
	if($N == 1){
		@box = $set;
		return @box;
	}else{
		@box = Fire($N - 1);
		@box[0] += $set;
		if(@box[0] >= 10 ** 4){
			@box[1] += @box / 10 **4;
			@box[0] %= 10**4;
		}
		my $length = @box;
		if($length > 1){
			for(my $i = 1; $i <= $length - 1; $i++){
				if(@box[0] >= 10 ** 4){
					@box[$i+1] += @box[$i] / 10 **4;
					@box[$i] %= 10**4;
				}
			}
		}
		return @box;
	}
}
0