結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー h_nosonh_noson
提出日時 2016-09-15 01:07:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,168 bytes
コンパイル時間 968 ms
コンパイル使用メモリ 87,376 KB
実行使用メモリ 8,852 KB
最終ジャッジ日時 2024-11-17 06:00:20
合計ジャッジ時間 3,149 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 12 ms
5,248 KB
testcase_04 AC 2 ms
5,248 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
5,248 KB
testcase_08 AC 2 ms
5,248 KB
testcase_09 AC 2 ms
5,248 KB
testcase_10 AC 2 ms
5,248 KB
testcase_11 AC 2 ms
5,248 KB
testcase_12 WA -
testcase_13 AC 2 ms
5,248 KB
testcase_14 AC 2 ms
5,248 KB
testcase_15 AC 2 ms
5,248 KB
testcase_16 AC 2 ms
5,248 KB
testcase_17 AC 2 ms
5,248 KB
testcase_18 AC 2 ms
5,248 KB
testcase_19 AC 12 ms
5,248 KB
testcase_20 AC 31 ms
5,248 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 51 ms
6,320 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 50 ms
6,048 KB
testcase_33 AC 103 ms
8,852 KB
testcase_34 AC 102 ms
8,724 KB
testcase_35 AC 92 ms
8,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

vector<int> get_primes(int n) {
    int i, j;
    vector<bool> prime(n+1);
    REP (i,2,n) prime[i] = true;
    for (i = 2; i * i <= n; i++) {
        if (prime[i]) {
            for (j = 2 * i; j <= n; j += i) {
                prime[j] = false;
            }
        }
    }
    vector<int> ret;
    REP (i,2,n) if (prime[i]) ret.push_back(i);
    return ret;
}

int main(void) {
    int n, l;
    cin >> n >> l;
    vector<int> primes = get_primes(l);
    ll ans = 0;
    for (auto x: primes) if ((n-1) * x <= l) {
        ans += l - (n-1) * x + 1;
    }
    cout << ans << endl;
    return 0;
}
0