結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー GodNegotoGodNegoto
提出日時 2019-11-28 10:18:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 142 ms / 1,000 ms
コード長 728 bytes
コンパイル時間 3,774 ms
コンパイル使用メモリ 77,676 KB
実行使用メモリ 54,388 KB
最終ジャッジ日時 2024-04-28 18:01:08
合計ジャッジ時間 9,311 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
54,056 KB
testcase_01 AC 138 ms
54,080 KB
testcase_02 AC 140 ms
54,092 KB
testcase_03 AC 136 ms
53,668 KB
testcase_04 AC 136 ms
54,080 KB
testcase_05 AC 136 ms
54,156 KB
testcase_06 AC 137 ms
53,904 KB
testcase_07 AC 136 ms
54,184 KB
testcase_08 AC 134 ms
54,088 KB
testcase_09 AC 137 ms
54,024 KB
testcase_10 AC 132 ms
54,168 KB
testcase_11 AC 138 ms
54,328 KB
testcase_12 AC 133 ms
54,112 KB
testcase_13 AC 134 ms
53,964 KB
testcase_14 AC 134 ms
53,940 KB
testcase_15 AC 136 ms
54,224 KB
testcase_16 AC 133 ms
53,524 KB
testcase_17 AC 135 ms
54,208 KB
testcase_18 AC 138 ms
54,076 KB
testcase_19 AC 134 ms
53,900 KB
testcase_20 AC 135 ms
54,000 KB
testcase_21 AC 135 ms
54,260 KB
testcase_22 AC 133 ms
54,388 KB
testcase_23 AC 134 ms
54,068 KB
testcase_24 AC 134 ms
54,332 KB
testcase_25 AC 135 ms
54,004 KB
testcase_26 AC 133 ms
54,152 KB
testcase_27 AC 134 ms
54,028 KB
testcase_28 AC 134 ms
54,156 KB
testcase_29 AC 135 ms
54,096 KB
testcase_30 AC 135 ms
53,960 KB
testcase_31 AC 140 ms
54,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package algo;

import java.util.*;

public class sample7 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a1 = sc.nextInt();
		int a2 = sc.nextInt();
		int a3 = sc.nextInt();
		int a4 = sc.nextInt();
		int a5 = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		list.add(a1);
		list.add(a2);
		list.add(a3);
		list.add(a4);
		list.add(a5);
		int sum = 0;
		for(int i = 0; i < list.size(); i++) {
			if(list.get(i) % 3 == 0 && list.get(i) % 5 == 0) {
				sum += 8;
			}
			else if (list.get(i) % 5 == 0) {
				sum += 4;
			}
			else if (list.get(i) % 3 == 0) {
				sum += 4;
			}
			else {
				sum += list.get(i).toString().length();
			}
		}
		System.out.println(sum);
	}
}
0