結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-05-30 12:33:44
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 300 bytes
コンパイル時間 1,160 ms
コンパイル使用メモリ 59,112 KB
実行使用メモリ 42,264 KB
最終ジャッジ日時 2023-09-12 20:35:52
合計ジャッジ時間 3,253 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 9 ms
6,656 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 10 ms
6,868 KB
testcase_20 AC 29 ms
14,772 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 49 ms
22,596 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 50 ms
22,280 KB
testcase_33 AC 162 ms
42,192 KB
testcase_34 AC 158 ms
42,264 KB
testcase_35 AC 138 ms
38,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(){
    int l,n;
    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;
    long long int r=0;
    for(int i=2;i<l;++i)if(s[i])r+=max(0,l-i*(n-1)+1);
    cout<<r<<endl;
    return 0;
}
0