結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー 37zigen
提出日時 2018-06-02 03:08:00
言語 Java
(openjdk 23)
結果
AC  
実行時間 135 ms / 1,000 ms
コード長 745 bytes
コンパイル時間 2,248 ms
コンパイル使用メモリ 75,068 KB
実行使用メモリ 54,336 KB
最終ジャッジ日時 2024-06-30 09:01:43
合計ジャッジ時間 7,548 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		for (int i = 0; i < a.length; ++i)
			a[i] = sc.nextInt();
		int ans = 0;
		for (int v : a) {
			if (v % 5 == 0 && v % 3 == 0) {
				ans += 8;
			} else if (v % 3 == 0) {
				ans += 4;
			} else if (v % 5 == 0) {
				ans += 4;
			} else {
				ans += String.valueOf(v).length();
			}
		}
		System.out.println(ans);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0