結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー tenten
提出日時 2020-11-12 09:18:14
言語 Java
(openjdk 23)
結果
AC  
実行時間 124 ms / 1,000 ms
コード長 718 bytes
コンパイル時間 2,162 ms
コンパイル使用メモリ 74,764 KB
実行使用メモリ 41,500 KB
最終ジャッジ日時 2024-07-22 19:03:55
合計ジャッジ時間 6,074 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

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