結果

問題 No.593 4進FizzBuzz
ユーザー tentententen
提出日時 2022-08-02 11:16:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 1,335 bytes
コンパイル時間 2,498 ms
コンパイル使用メモリ 73,856 KB
実行使用メモリ 61,592 KB
最終ジャッジ日時 2023-09-30 10:00:43
合計ジャッジ時間 11,050 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
33,156 KB
testcase_01 AC 36 ms
33,156 KB
testcase_02 AC 37 ms
33,116 KB
testcase_03 AC 35 ms
33,164 KB
testcase_04 AC 36 ms
33,380 KB
testcase_05 AC 36 ms
33,124 KB
testcase_06 AC 37 ms
33,164 KB
testcase_07 AC 36 ms
33,160 KB
testcase_08 AC 36 ms
33,436 KB
testcase_09 AC 34 ms
33,368 KB
testcase_10 AC 34 ms
33,136 KB
testcase_11 AC 35 ms
33,160 KB
testcase_12 AC 36 ms
33,136 KB
testcase_13 AC 44 ms
47,524 KB
testcase_14 AC 42 ms
49,016 KB
testcase_15 AC 43 ms
49,364 KB
testcase_16 AC 183 ms
61,592 KB
testcase_17 AC 188 ms
46,180 KB
testcase_18 AC 187 ms
46,572 KB
testcase_19 AC 204 ms
46,036 KB
testcase_20 AC 188 ms
46,296 KB
testcase_21 AC 180 ms
46,240 KB
testcase_22 AC 207 ms
46,928 KB
testcase_23 AC 180 ms
46,416 KB
testcase_24 AC 187 ms
45,668 KB
testcase_25 AC 176 ms
46,208 KB
testcase_26 AC 194 ms
46,472 KB
testcase_27 AC 203 ms
45,948 KB
testcase_28 AC 183 ms
46,272 KB
testcase_29 AC 200 ms
46,344 KB
testcase_30 AC 187 ms
45,840 KB
testcase_31 AC 189 ms
46,300 KB
testcase_32 AC 184 ms
47,212 KB
testcase_33 AC 198 ms
46,564 KB
testcase_34 AC 181 ms
45,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

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

class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0