結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー jimanojimano
提出日時 2015-10-11 16:35:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 606 bytes
コンパイル時間 3,993 ms
コンパイル使用メモリ 72,748 KB
実行使用メモリ 55,916 KB
最終ジャッジ日時 2023-09-28 11:45:52
合計ジャッジ時間 4,395 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,688 KB
testcase_01 AC 123 ms
55,872 KB
testcase_02 AC 127 ms
55,892 KB
testcase_03 AC 129 ms
55,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No9002 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        final String f = "Fizz";
        final String b = "Buzz";
        final String fb = f+b;

        for(int i = 1; i < a + 1; i++){
        	if(i % 15 == 0){
        		System.out.println(fb);
        	}
        	else if (i % 3 == 0){
        		System.out.println(f);
        	}
        	else if (i % 5 == 0){
        		System.out.println(b);
        	}
        	else {
        		System.out.println(i);
        	}
        }
    }
}
0