結果

問題 No.593 4進FizzBuzz
ユーザー tentententen
提出日時 2020-09-07 14:26:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 300 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 4,791 ms
コンパイル使用メモリ 71,408 KB
実行使用メモリ 65,088 KB
最終ジャッジ日時 2023-08-19 16:47:45
合計ジャッジ時間 13,282 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
55,596 KB
testcase_01 AC 103 ms
55,424 KB
testcase_02 AC 99 ms
55,748 KB
testcase_03 AC 98 ms
55,828 KB
testcase_04 AC 100 ms
55,816 KB
testcase_05 AC 98 ms
55,620 KB
testcase_06 AC 98 ms
55,556 KB
testcase_07 AC 97 ms
55,484 KB
testcase_08 AC 100 ms
55,616 KB
testcase_09 AC 99 ms
56,012 KB
testcase_10 AC 97 ms
55,408 KB
testcase_11 AC 96 ms
55,568 KB
testcase_12 AC 100 ms
55,688 KB
testcase_13 AC 97 ms
55,188 KB
testcase_14 AC 98 ms
55,600 KB
testcase_15 AC 98 ms
55,512 KB
testcase_16 AC 283 ms
63,392 KB
testcase_17 AC 286 ms
65,088 KB
testcase_18 AC 248 ms
51,424 KB
testcase_19 AC 261 ms
51,900 KB
testcase_20 AC 245 ms
52,004 KB
testcase_21 AC 278 ms
52,016 KB
testcase_22 AC 292 ms
51,872 KB
testcase_23 AC 286 ms
51,744 KB
testcase_24 AC 287 ms
51,360 KB
testcase_25 AC 252 ms
51,656 KB
testcase_26 AC 300 ms
51,740 KB
testcase_27 AC 287 ms
51,932 KB
testcase_28 AC 247 ms
51,804 KB
testcase_29 AC 264 ms
51,928 KB
testcase_30 AC 273 ms
51,872 KB
testcase_31 AC 254 ms
52,008 KB
testcase_32 AC 275 ms
51,912 KB
testcase_33 AC 289 ms
51,924 KB
testcase_34 AC 288 ms
52,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	char[] arr = sc.next().toCharArray();
    	int mod3 = 0;
    	int mod5 = 0;
    	for (char c : arr) {
    	    mod3 = (mod3 * 4 + c - '0') % 3;
    	    mod5 = (mod5 * 4 + c - '0') % 5;
    	}
    	if (mod3 == 0 && mod5 == 0) {
    	    System.out.println("FizzBuzz");
    	} else if (mod5 == 0) {
    	    System.out.println("Buzz");
    	} else if (mod3 == 0) {
    	    System.out.println("Fizz");
    	} else {
    	    System.out.println(arr);
    	}
    }
}
0