結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-05-30 12:40:38
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 158 ms / 1,000 ms
コード長 306 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 58,612 KB
実行使用メモリ 42,464 KB
最終ジャッジ日時 2023-09-12 20:36:08
合計ジャッジ時間 2,746 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 10 ms
7,040 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 146 ms
40,440 KB
testcase_06 AC 54 ms
23,536 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 10 ms
6,872 KB
testcase_20 AC 31 ms
14,700 KB
testcase_21 AC 13 ms
8,436 KB
testcase_22 AC 11 ms
7,148 KB
testcase_23 AC 19 ms
10,444 KB
testcase_24 AC 30 ms
14,756 KB
testcase_25 AC 56 ms
22,544 KB
testcase_26 AC 54 ms
22,512 KB
testcase_27 AC 8 ms
5,984 KB
testcase_28 AC 22 ms
11,552 KB
testcase_29 AC 49 ms
21,988 KB
testcase_30 AC 8 ms
6,460 KB
testcase_31 AC 40 ms
18,620 KB
testcase_32 AC 51 ms
22,276 KB
testcase_33 AC 158 ms
42,224 KB
testcase_34 AC 149 ms
42,464 KB
testcase_35 AC 131 ms
38,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
#define ll long long int
int main(){
    ll n,l,r=0;
    cin>>n>>l;
    vector<int> s(l,1);
    for(int i=2;i*i<l;++i)if(s[i])for(int j=i+i;j<l;j+=i)s[j]=0;
    for(ll i=2;i<l;++i)if(s[i])r+=max(0LL,l-i*(n-1)+1);
    cout<<r<<endl;
    return 0;
}
0