結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー troro_kelptroro_kelp
提出日時 2018-06-22 18:35:28
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 550 bytes
コンパイル時間 1,891 ms
コンパイル使用メモリ 144,224 KB
実行使用メモリ 13,160 KB
最終ジャッジ日時 2023-09-13 08:03:07
合計ジャッジ時間 3,151 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 6 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 6 ms
4,396 KB
testcase_20 AC 19 ms
6,228 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 31 ms
8,240 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 31 ms
8,152 KB
testcase_33 AC 67 ms
13,160 KB
testcase_34 AC 66 ms
13,044 KB
testcase_35 AC 61 ms
12,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int N, L;
    
    cin >> N >> L;
    bool sieve[L+1]; 
    for(int i=0; i<L+1; ++i){
        sieve[i]=true;
    }
    sieve[0] = sieve[1] = false;
    for(int i=2; i*i<L+1; ++i){
        if(sieve[i]){
            for(int j=2; i*j<L+1; ++j){
                sieve[i*j] = false;
            }
        }
    }
    long long ans = 0;
    for(int i=0; i<L; ++i){
        if(sieve[i]&&i*(N-1) <= L){
            ans += L - i*(N-1)+1;
        }
    }
    cout << ans << endl;
    return 0;
}
0