結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー tentententen
提出日時 2020-11-12 09:18:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 1,000 ms
コード長 718 bytes
コンパイル時間 2,172 ms
コンパイル使用メモリ 72,184 KB
実行使用メモリ 56,152 KB
最終ジャッジ日時 2023-09-30 01:07:04
合計ジャッジ時間 7,775 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,724 KB
testcase_01 AC 127 ms
55,960 KB
testcase_02 AC 126 ms
55,784 KB
testcase_03 AC 127 ms
55,512 KB
testcase_04 AC 128 ms
55,728 KB
testcase_05 AC 127 ms
55,428 KB
testcase_06 AC 125 ms
55,692 KB
testcase_07 AC 135 ms
56,020 KB
testcase_08 AC 125 ms
56,004 KB
testcase_09 AC 125 ms
55,820 KB
testcase_10 AC 127 ms
56,132 KB
testcase_11 AC 127 ms
55,860 KB
testcase_12 AC 128 ms
55,456 KB
testcase_13 AC 127 ms
55,536 KB
testcase_14 AC 128 ms
56,004 KB
testcase_15 AC 125 ms
55,824 KB
testcase_16 AC 128 ms
56,048 KB
testcase_17 AC 127 ms
55,472 KB
testcase_18 AC 127 ms
56,128 KB
testcase_19 AC 125 ms
55,928 KB
testcase_20 AC 130 ms
55,688 KB
testcase_21 AC 126 ms
55,700 KB
testcase_22 AC 125 ms
55,692 KB
testcase_23 AC 129 ms
55,944 KB
testcase_24 AC 126 ms
55,760 KB
testcase_25 AC 126 ms
55,700 KB
testcase_26 AC 127 ms
55,832 KB
testcase_27 AC 126 ms
55,796 KB
testcase_28 AC 126 ms
55,816 KB
testcase_29 AC 126 ms
55,920 KB
testcase_30 AC 129 ms
56,152 KB
testcase_31 AC 126 ms
55,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        for (int i = 0; i < 5; i++) {
            int x = sc.nextInt();
            if (x % 3 == 0 && x % 5 == 0) {
                count += 8;
            } else if (x % 3 == 0) {
                count += 4;
            } else if (x % 5 == 0) {
                count += 4;
            } else {
                count += getCount(x);
            }
        }
        System.out.println(count);
    }
    
    static int getCount(int x) {
        int count = 0;
        while (x > 0) {
            count++;
            x /= 10;
        }
        return count;
    }
}
0