結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー latte0119latte0119
提出日時 2016-08-05 22:31:16
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 90 ms / 1,000 ms
コード長 890 bytes
コンパイル時間 1,590 ms
コンパイル使用メモリ 143,644 KB
実行使用メモリ 13,208 KB
最終ジャッジ日時 2023-08-22 02:25:46
合計ジャッジ時間 3,264 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 20 ms
12,620 KB
testcase_06 AC 10 ms
9,472 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 7 ms
4,380 KB
testcase_20 AC 22 ms
7,404 KB
testcase_21 AC 3 ms
4,696 KB
testcase_22 AC 3 ms
4,680 KB
testcase_23 AC 7 ms
5,208 KB
testcase_24 AC 7 ms
7,396 KB
testcase_25 AC 37 ms
9,480 KB
testcase_26 AC 10 ms
9,548 KB
testcase_27 AC 3 ms
4,380 KB
testcase_28 AC 6 ms
7,448 KB
testcase_29 AC 11 ms
9,532 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 11 ms
7,468 KB
testcase_32 AC 33 ms
9,456 KB
testcase_33 AC 90 ms
13,208 KB
testcase_34 AC 90 ms
13,108 KB
testcase_35 AC 75 ms
12,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

bool f[10000001];

signed main(){
    int N,L;
    cin>>N>>L;
    fill_n(f,L+1,1);
    f[0]=f[1]=0;

    int ans=0;
    for(int i=2;i<=L;i++){
        if(!f[i])continue;
        int t=i*(N-1);
        if(t>L)break;
        ans+=L-t+1;
        for(int j=i+i;j<=L;j+=i)f[j]=0;
    }

    cout<<ans<<endl;
    return 0;
}
0