結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー fantom_1xfantom_1x
提出日時 2016-04-04 17:00:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 64 ms / 5,000 ms
コード長 603 bytes
コンパイル時間 2,131 ms
コンパイル使用メモリ 83,864 KB
実行使用メモリ 50,700 KB
最終ジャッジ日時 2024-04-14 06:58:55
合計ジャッジ時間 3,020 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
50,356 KB
testcase_01 AC 59 ms
50,244 KB
testcase_02 AC 59 ms
50,268 KB
testcase_03 AC 64 ms
50,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		new Main();
	}

	public Main() throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine().trim();
		int n = Integer.parseInt(line);
		br.close();

		for (int i = 1; i <= n; i++) {
			String s = "";
			if (i % 3 == 0) {
				s += "Fizz";
			}
			if (i % 5 == 0) {
				s += "Buzz";
			}
			if (s.length() > 0) {
				System.out.println(s);
			} else {
				System.out.println(i);
			}
		}
	}
}
0