結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー マサ
提出日時 2022-02-08 21:46:35
言語 Java
(openjdk 23)
結果
AC  
実行時間 134 ms / 1,000 ms
コード長 421 bytes
コンパイル時間 2,178 ms
コンパイル使用メモリ 74,444 KB
実行使用メモリ 54,448 KB
最終ジャッジ日時 2024-06-23 17:35:53
合計ジャッジ時間 7,506 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			int a = sc.nextInt();
			
			if (a % 3 == 0 && a % 5 == 0) {
				sum += 8;
			} else if (a % 3 == 0 || a % 5 == 0) {
				sum += 4;
			} else {
				sum += String.valueOf(a).length();
			}
			
		}
		System.out.println(sum);
		sc.close();
	}
}
0