結果

問題 No.311 z in FizzBuzzString
ユーザー nullzinenullzine
提出日時 2017-01-24 17:50:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 1,500 ms
コード長 579 bytes
コンパイル時間 2,186 ms
コンパイル使用メモリ 78,940 KB
実行使用メモリ 57,688 KB
最終ジャッジ日時 2023-10-25 02:48:50
合計ジャッジ時間 4,317 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
57,600 KB
testcase_01 AC 124 ms
57,688 KB
testcase_02 AC 127 ms
57,508 KB
testcase_03 AC 125 ms
57,504 KB
testcase_04 AC 126 ms
57,496 KB
testcase_05 AC 127 ms
57,432 KB
testcase_06 AC 126 ms
57,256 KB
testcase_07 AC 125 ms
57,496 KB
testcase_08 AC 122 ms
57,160 KB
testcase_09 AC 124 ms
57,420 KB
testcase_10 AC 124 ms
57,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.stream.LongStream;

/**
 * Created by nullzine on 2017/01/20.
 */
public class Main {

    public static void main(String[] args) {
        new Main().run2();
    }

    private void run() {
        System.out.println(LongStream.range(1, Long.parseLong(new java.util.Scanner(System.in).nextLine()) + 1).parallel().map(m -> m % 3 == 0 && m % 5 == 0 ? 4 : (m % 3 == 0 || m % 5 == 0 ? 2 : 0)).sum());
    }

    private void run2(){
        long n = Long.parseLong(new java.util.Scanner(System.in).nextLine());
        System.out.println((n/3)*2+(n/5)*2);
    }

}
0