結果

問題 No.3022 縛りFizzBuzz (Easy)
ユーザー shinwisteriashinwisteria
提出日時 2017-03-31 22:40:11
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 580 bytes
コンパイル時間 3,738 ms
コンパイル使用メモリ 72,808 KB
実行使用メモリ 56,384 KB
最終ジャッジ日時 2023-09-21 10:59:55
合計ジャッジ時間 5,122 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class FizzBuzz {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		s.close();
		String str = "abcdef";
		int t = str.indexOf("d");
		int f = str.indexOf("f");
		for(int i = str.indexOf("b");i <= N;i++){
			if(i % t == 0&&i % f == 0){
				System.out.println("FizzBuzz");
			}else if(i%t == 0){
				System.out.println("Fizz");
			}else if(i % f == 0){
				System.out.println("Buzz");
			}else{
				System.out.println(i);
			}
		}
	}

}
0