結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー fog_878
提出日時 2019-03-15 22:15:19
言語 Java
(openjdk 23)
結果
AC  
実行時間 170 ms / 5,000 ms
コード長 431 bytes
コンパイル時間 2,299 ms
コンパイル使用メモリ 77,396 KB
実行使用メモリ 42,692 KB
最終ジャッジ日時 2024-07-01 21:06:46
合計ジャッジ時間 3,587 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		sc.close();

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

	}

}
0