結果

問題 No.593 4進FizzBuzz
ユーザー tentententen
提出日時 2023-07-27 17:43:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 224 ms / 2,000 ms
コード長 1,913 bytes
コンパイル時間 2,947 ms
コンパイル使用メモリ 84,712 KB
実行使用メモリ 62,720 KB
最終ジャッジ日時 2024-04-15 04:48:17
合計ジャッジ時間 9,415 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
50,172 KB
testcase_01 AC 48 ms
50,192 KB
testcase_02 AC 48 ms
50,448 KB
testcase_03 AC 50 ms
50,156 KB
testcase_04 AC 49 ms
50,288 KB
testcase_05 AC 48 ms
50,148 KB
testcase_06 AC 50 ms
50,384 KB
testcase_07 AC 50 ms
50,080 KB
testcase_08 AC 49 ms
50,436 KB
testcase_09 AC 49 ms
50,360 KB
testcase_10 AC 49 ms
50,140 KB
testcase_11 AC 49 ms
50,440 KB
testcase_12 AC 48 ms
50,184 KB
testcase_13 AC 48 ms
50,372 KB
testcase_14 AC 50 ms
50,484 KB
testcase_15 AC 49 ms
50,376 KB
testcase_16 AC 192 ms
62,700 KB
testcase_17 AC 204 ms
62,528 KB
testcase_18 AC 193 ms
62,300 KB
testcase_19 AC 216 ms
62,300 KB
testcase_20 AC 191 ms
62,480 KB
testcase_21 AC 187 ms
62,524 KB
testcase_22 AC 224 ms
62,092 KB
testcase_23 AC 195 ms
62,532 KB
testcase_24 AC 192 ms
62,360 KB
testcase_25 AC 192 ms
62,216 KB
testcase_26 AC 217 ms
62,580 KB
testcase_27 AC 222 ms
62,540 KB
testcase_28 AC 191 ms
62,356 KB
testcase_29 AC 216 ms
62,552 KB
testcase_30 AC 197 ms
62,720 KB
testcase_31 AC 191 ms
62,632 KB
testcase_32 AC 189 ms
62,240 KB
testcase_33 AC 218 ms
62,536 KB
testcase_34 AC 193 ms
62,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        char[] inputs = sc.next().toCharArray();
        int value = 0;
        for (char c : inputs) {
            value *= 4;
            value += c - '0';
            value %= 15;
        }
        String ans;
        if (value % 15 == 0) {
            ans = "FizzBuzz";
        } else if (value % 3 == 0) {
            ans = "Fizz";
        } else if (value % 5 == 0) {
            ans = "Buzz";
        } else {
            ans = new String(inputs);
        }
        System.out.println(ans);
    }
} 
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    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 int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0