結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー jimanojimano
提出日時 2018-01-26 23:52:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 46 ms / 1,000 ms
コード長 801 bytes
コンパイル時間 3,738 ms
コンパイル使用メモリ 72,240 KB
実行使用メモリ 51,204 KB
最終ジャッジ日時 2023-09-11 04:20:18
合計ジャッジ時間 6,509 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,424 KB
testcase_01 AC 45 ms
49,524 KB
testcase_02 AC 45 ms
49,528 KB
testcase_03 AC 45 ms
49,360 KB
testcase_04 AC 46 ms
49,348 KB
testcase_05 AC 45 ms
49,496 KB
testcase_06 AC 45 ms
49,272 KB
testcase_07 AC 44 ms
49,372 KB
testcase_08 AC 45 ms
49,164 KB
testcase_09 AC 44 ms
49,276 KB
testcase_10 AC 44 ms
49,176 KB
testcase_11 AC 44 ms
49,148 KB
testcase_12 AC 44 ms
49,392 KB
testcase_13 AC 44 ms
49,176 KB
testcase_14 AC 45 ms
49,636 KB
testcase_15 AC 44 ms
49,192 KB
testcase_16 AC 44 ms
49,252 KB
testcase_17 AC 44 ms
49,316 KB
testcase_18 AC 44 ms
49,100 KB
testcase_19 AC 43 ms
49,508 KB
testcase_20 AC 43 ms
49,208 KB
testcase_21 AC 45 ms
49,656 KB
testcase_22 AC 44 ms
49,152 KB
testcase_23 AC 45 ms
49,364 KB
testcase_24 AC 45 ms
49,408 KB
testcase_25 AC 44 ms
49,784 KB
testcase_26 AC 45 ms
51,204 KB
testcase_27 AC 44 ms
49,168 KB
testcase_28 AC 44 ms
49,276 KB
testcase_29 AC 43 ms
49,008 KB
testcase_30 AC 44 ms
49,200 KB
testcase_31 AC 44 ms
49,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No0637 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			final String f = "Fizz";
			final String b = "Buzz";
			final String fb = f + b;
			int sum = 0;
			String[] input = br.readLine().split(" ");

			for (int i = 0; i < input.length; i++) {
				int num = Integer.parseInt(input[i]);
				if (num % 15 == 0) {
					sum += fb.length();
				} else if (num % 3 == 0) {
					sum += f.length();
				} else if (num % 5 == 0) {
					sum += b.length();
				} else {
					sum += input[i].length();
				}
			}
			System.out.println(sum);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0