結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2018-04-12 01:45:05
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 265 ms / 1,000 ms
コード長 742 bytes
コンパイル時間 1,106 ms
コンパイル使用メモリ 81,364 KB
実行使用メモリ 42,456 KB
最終ジャッジ日時 2023-09-09 04:12:13
合計ジャッジ時間 3,970 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 12 ms
7,352 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 231 ms
42,228 KB
testcase_06 AC 86 ms
23,728 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 13 ms
7,404 KB
testcase_20 AC 41 ms
15,596 KB
testcase_21 AC 16 ms
9,444 KB
testcase_22 AC 14 ms
9,452 KB
testcase_23 AC 26 ms
11,512 KB
testcase_24 AC 42 ms
15,780 KB
testcase_25 AC 80 ms
23,856 KB
testcase_26 AC 91 ms
23,800 KB
testcase_27 AC 10 ms
7,480 KB
testcase_28 AC 29 ms
13,624 KB
testcase_29 AC 81 ms
24,024 KB
testcase_30 AC 12 ms
7,344 KB
testcase_31 AC 57 ms
19,740 KB
testcase_32 AC 87 ms
23,784 KB
testcase_33 AC 265 ms
42,388 KB
testcase_34 AC 248 ms
42,456 KB
testcase_35 AC 222 ms
40,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;


int p[10000000] = {0};

int main() {
    long long N,L;
    cin >> N >> L;

    for ( long long i = 2; i <= L; i++ ) {
        if ( p[i] == 0 ) {
            for ( int j = i*2; j <= L; j += i ) {
                p[j] = 1;
            }
        }
    }

    long long ans = 0;
    for ( long long i = 2; i <= L; i++ ) {
        if ( p[i] == 0 && i*(N-1) <= L ) {
            ans += L-i*(N-1)+1;
        }
    }
    cout << ans << endl;

    return 0;
}
0