結果

問題 No.311 z in FizzBuzzString
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-05-03 08:25:32
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 676 bytes
コンパイル時間 1,927 ms
コンパイル使用メモリ 74,832 KB
実行使用メモリ 58,724 KB
最終ジャッジ日時 2023-10-25 02:50:26
合計ジャッジ時間 5,379 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
57,632 KB
testcase_01 AC 55 ms
53,308 KB
testcase_02 AC 52 ms
53,288 KB
testcase_03 AC 53 ms
53,284 KB
testcase_04 AC 52 ms
53,288 KB
testcase_05 AC 53 ms
53,288 KB
testcase_06 AC 53 ms
53,288 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        long N = Long.parseLong(reader.readLine());
        long counter = 0;
        for (long i = 3; i <= N; i++) {
            if (i % 15 == 0) {
                counter += 4;
            } else if (i % 5 == 0) {
                counter += 2;
            } else if (i % 3 == 0) {
                counter += 2;
            }
        }
        System.out.println(counter);
    }


}
0