結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー kuramukuramu
提出日時 2016-01-19 15:46:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 620 bytes
コンパイル時間 2,237 ms
コンパイル使用メモリ 80,044 KB
実行使用メモリ 53,500 KB
最終ジャッジ日時 2023-10-21 06:51:35
合計ジャッジ時間 3,257 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
52,388 KB
testcase_01 AC 60 ms
53,500 KB
testcase_02 AC 60 ms
52,560 KB
testcase_03 AC 63 ms
53,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {

	public static void main(String[] args) {
		BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in));
		try {
			int n = Integer.parseInt(stdReader.readLine());
			for(int i=1;i<n+1;i++){
				String result = "";
				if(i%3==0&&i%5==0){
					result = "FizzBuzz";
				}else if(i%3==0){
					result = "Fizz";
				}else if(i%5==0){
					result = "Buzz";
				}else{
					result = ""+i;
				}
				System.out.println(result);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0