結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー okenineko25okenineko25
提出日時 2015-04-24 03:06:15
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 470 bytes
コンパイル時間 44 ms
コンパイル使用メモリ 11,224 KB
実行使用メモリ 15,516 KB
最終ジャッジ日時 2023-09-18 08:51:23
合計ジャッジ時間 853 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

input_file = ARGV[0]
output_file = ARGV[1]
f = open(input_file, "r")
input = f.read
f.close
output_lines = ""
for num in 1..input.to_i do
	if num.modulo(3) == 0
		output_str = "Fizz"
		if num.modulo(5) == 0
			output_str = "FizzBuzz"
		end
	elsif num.modulo(5) == 0
		output_str = "Buzz"
	else
		output_str = num.to_s
	end
	output_line = output_str + "\n"
	output_lines += output_line
end
print(output_lines)
f_w = open(output_file, "w")
f_w.puts(output_lines)
f_w.close
0