結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー BantakoBantako
提出日時 2017-07-27 23:32:54
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 168 ms / 1,000 ms
コード長 399 bytes
コンパイル時間 2,844 ms
コンパイル使用メモリ 142,460 KB
実行使用メモリ 42,724 KB
最終ジャッジ日時 2023-07-31 08:32:06
合計ジャッジ時間 8,313 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
42,604 KB
testcase_01 AC 127 ms
42,604 KB
testcase_02 AC 129 ms
42,524 KB
testcase_03 AC 128 ms
42,516 KB
testcase_04 AC 140 ms
42,540 KB
testcase_05 AC 137 ms
42,468 KB
testcase_06 AC 132 ms
42,524 KB
testcase_07 AC 132 ms
42,468 KB
testcase_08 AC 141 ms
42,444 KB
testcase_09 AC 128 ms
42,720 KB
testcase_10 AC 125 ms
42,500 KB
testcase_11 AC 126 ms
42,480 KB
testcase_12 AC 124 ms
42,524 KB
testcase_13 AC 140 ms
42,504 KB
testcase_14 AC 136 ms
42,480 KB
testcase_15 AC 133 ms
42,524 KB
testcase_16 AC 168 ms
42,508 KB
testcase_17 AC 138 ms
42,520 KB
testcase_18 AC 137 ms
42,564 KB
testcase_19 AC 137 ms
42,532 KB
testcase_20 AC 143 ms
42,448 KB
testcase_21 AC 125 ms
42,560 KB
testcase_22 AC 120 ms
42,564 KB
testcase_23 AC 130 ms
42,540 KB
testcase_24 AC 132 ms
42,540 KB
testcase_25 AC 147 ms
42,580 KB
testcase_26 AC 132 ms
42,596 KB
testcase_27 AC 137 ms
42,428 KB
testcase_28 AC 147 ms
42,600 KB
testcase_29 AC 165 ms
42,524 KB
testcase_30 AC 129 ms
42,524 KB
testcase_31 AC 133 ms
42,520 KB
testcase_32 AC 127 ms
42,724 KB
testcase_33 AC 136 ms
42,604 KB
testcase_34 AC 136 ms
42,504 KB
testcase_35 AC 127 ms
42,524 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main(){
      ^

ソースコード

diff #

#include<bits/stdc++.h>
int prime[10000000];
main(){
    for(int i = 2;i*i <=10000000;i++){
        if(prime[i])continue;
        for(int j = i*2;j < 10000000;j+=i)prime[j]=1;
    }
    int N,L;
    scanf("%d%d",&N,&L);
    long long sum = 0;
    for(int i = 2;i < 10000000;i++){
        if(prime[i])continue;
        if(i*(N-1)>L)break;
        sum += L-i*(N-1)+1;
    }
    printf("%lld\n",sum);
}
0