結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー NagisaNagisa
提出日時 2016-08-23 22:33:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 702 bytes
コンパイル時間 1,896 ms
コンパイル使用メモリ 169,392 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-28 23:29:13
合計ジャッジ時間 7,717 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 12 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 64 ms
5,376 KB
testcase_20 AC 288 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 587 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 218 ms
5,376 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 AC 510 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;
using namespace std;

vector<int> prime(int N){
// returns the list of prime numbers below N
    vector<int> v;
    v.push_back(2);
    for(int i=3; i<=N; i+=2){
        bool flag = true;
        for(int j=3; j<=sqrt(i); j+=2){
            if(i%j==0){
                flag = false;
                break;
            }
        }
        if (flag==true) v.push_back(i);
    }
    return v;
}

int main(){
    int N, L;
    cin >> N >> L;
    vector<int> P = prime(L/(N-1));
    ll ans = 0;
    for(int e: P){
        ans += 1+L-e*(N-1);
    }
    ll t = 0;
    cout << max(t,ans) << endl;
    return 0;
}
0