結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,760 KB
testcase_01 AC 4 ms
5,964 KB
testcase_02 AC 4 ms
5,792 KB
testcase_03 AC 4 ms
5,840 KB
testcase_04 AC 4 ms
5,840 KB
testcase_05 AC 5 ms
6,504 KB
testcase_06 AC 6 ms
6,748 KB
testcase_07 MLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;

my $N = <STDIN>;
my $str = Fire($N);
#my $count = (() = $str =~ /z/g);
#print $count."\n";
print $str."\n";

sub Fire
{
	my $str = "";
	my $N = $_[0];
	if($N % 3 == 0 && $N % 5 == 0)
	{
		#$str = "FizzBuzz";
		$str = 4;
	}
	elsif($N % 3 == 0)
	{
		#$str = "Fizz";
		$str = 2;
	}
	elsif($N % 5 == 0)
	{
		#$str = "Buzz";
		$str = 2;
	}
	else
	{
		#$str = $N;
	}
	if($N == 1)
	{
		return $str;
	}
	else
	{
		return $str + Fire($N - 1);
	}
}
0