結果

問題 No.3022 縛りFizzBuzz (Easy)
ユーザー tanzakutanzaku
提出日時 2017-03-31 22:42:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 767 bytes
コンパイル時間 3,688 ms
コンパイル使用メモリ 71,868 KB
実行使用メモリ 56,212 KB
最終ジャッジ日時 2023-09-21 11:00:38
合計ジャッジ時間 5,198 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

import java.math.BigInteger;
import java.util.Scanner;

public class yuki {
	public static void main(String[] args) {
		BigInteger b = BigInteger.ONE;
		Scanner sc = new Scanner(System.in);
		BigInteger high = sc.nextBigInteger();
		BigInteger three = BigInteger.valueOf('D' - 'A');
		BigInteger five = BigInteger.valueOf('F' - 'A');
		for (; b.compareTo(high) <= BigInteger.ZERO.intValue(); b = b.add(BigInteger.ONE)) {
			if (b.mod(three).equals(BigInteger.ZERO) && b.mod(five).equals(BigInteger.ZERO)) {
				System.out.println("FizzBuzz");
			} else if (b.mod(three).equals(BigInteger.ZERO)) {
				System.out.println("Fizz");
			} else if (b.mod(five).equals(BigInteger.ZERO)) {
				System.out.println("Buzz");
			} else {
				System.out.println(b);
			}
		}
	}
}
0