結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー denderaKawazu
提出日時 2018-02-13 23:00:40
言語 Java
(openjdk 23)
結果
AC  
実行時間 125 ms / 1,000 ms
コード長 1,119 bytes
コンパイル時間 1,739 ms
コンパイル使用メモリ 74,396 KB
実行使用メモリ 41,768 KB
最終ジャッジ日時 2024-06-28 18:57:19
合計ジャッジ時間 6,245 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int count = 0;
            for (int i = 0; i < 5; i++) {
                int n = in.nextInt();
                boolean three = n % 3 == 0;
                boolean five = n % 5 == 0;
                if (three && five) count += 8;
                else if (three) count += 4;
                else if (five) count += 4;
                else count += String.valueOf(n).length();
            }
            out.println(count);
        }

    }
}

0