結果

問題 No.311 z in FizzBuzzString
ユーザー fkwnw3_1243
提出日時 2017-05-03 08:25:32
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 676 bytes
コンパイル時間 1,834 ms
コンパイル使用メモリ 74,468 KB
実行使用メモリ 58,484 KB
最終ジャッジ日時 2024-09-24 21:57:29
合計ジャッジ時間 5,281 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 TLE * 1 -- * 3
権限があれば一括ダウンロードができます

ソースコード

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