結果

問題 No.593 4進FizzBuzz
ユーザー maimai
提出日時 2017-08-03 07:37:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 445 ms / 2,000 ms
コード長 822 bytes
コンパイル時間 3,583 ms
コンパイル使用メモリ 74,940 KB
実行使用メモリ 54,872 KB
最終ジャッジ日時 2024-04-22 14:40:19
合計ジャッジ時間 15,636 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
41,172 KB
testcase_01 AC 126 ms
41,160 KB
testcase_02 AC 129 ms
40,944 KB
testcase_03 AC 130 ms
41,080 KB
testcase_04 AC 129 ms
41,432 KB
testcase_05 AC 131 ms
41,136 KB
testcase_06 AC 129 ms
40,988 KB
testcase_07 AC 131 ms
41,112 KB
testcase_08 AC 115 ms
39,924 KB
testcase_09 AC 114 ms
39,900 KB
testcase_10 AC 128 ms
41,236 KB
testcase_11 AC 128 ms
41,256 KB
testcase_12 AC 129 ms
41,272 KB
testcase_13 AC 125 ms
40,944 KB
testcase_14 AC 125 ms
41,076 KB
testcase_15 AC 111 ms
40,184 KB
testcase_16 AC 388 ms
54,416 KB
testcase_17 AC 410 ms
54,808 KB
testcase_18 AC 412 ms
54,844 KB
testcase_19 AC 437 ms
54,572 KB
testcase_20 AC 395 ms
54,416 KB
testcase_21 AC 373 ms
54,592 KB
testcase_22 AC 435 ms
54,736 KB
testcase_23 AC 373 ms
54,492 KB
testcase_24 AC 391 ms
54,480 KB
testcase_25 AC 401 ms
54,872 KB
testcase_26 AC 437 ms
54,852 KB
testcase_27 AC 408 ms
54,712 KB
testcase_28 AC 376 ms
54,604 KB
testcase_29 AC 430 ms
54,692 KB
testcase_30 AC 445 ms
54,756 KB
testcase_31 AC 374 ms
54,664 KB
testcase_32 AC 389 ms
54,612 KB
testcase_33 AC 422 ms
54,728 KB
testcase_34 AC 390 ms
54,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.lang.*;
import java.math.*;

public class prog {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        
        int odd = 0;
        int even = 0;
        
        for (int i = 0; i < line.length(); ++i){
            int c = line.charAt(i) - '0';
            if (i%2 == 1) odd  += c;
            else          even += c;
        }
        
        boolean div5 = (odd - even) % 5 == 0;
        boolean div3 = (odd + even) % 3 == 0;
        
        if (div5 && div3){
            System.out.println("FizzBuzz");
        }else if (div5){
            System.out.println("Buzz");
        }else if (div3){
            System.out.println("Fizz");
        }else{
            System.out.println(line);
        }
	}
}
0