結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー gomagoma
提出日時 2017-09-14 20:51:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 429 bytes
コンパイル時間 2,222 ms
コンパイル使用メモリ 74,452 KB
実行使用メモリ 41,360 KB
最終ジャッジ日時 2024-04-25 09:23:54
合計ジャッジ時間 3,352 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
41,272 KB
testcase_01 AC 138 ms
41,360 KB
testcase_02 AC 141 ms
41,256 KB
testcase_03 AC 147 ms
41,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for (int i = 1; i <= n; i++) {
			if (i % 3 == 0 && i % 5 == 0) {
				System.out.println("FizzBuzz");
			} else if (i % 3 == 0) {
				System.out.println("Fizz");
			} else if (i % 5 == 0) {
				System.out.println("Buzz");
			} else {
				System.out.println(i);
			}
		}
	}
}
0