結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー BantakoBantako
提出日時 2017-07-27 23:32:54
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 180 ms / 1,000 ms
コード長 399 bytes
コンパイル時間 1,660 ms
コンパイル使用メモリ 158,728 KB
実行使用メモリ 42,752 KB
最終ジャッジ日時 2024-04-18 09:00:02
合計ジャッジ時間 8,853 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 158 ms
42,588 KB
testcase_01 AC 163 ms
42,752 KB
testcase_02 AC 165 ms
42,496 KB
testcase_03 AC 164 ms
42,656 KB
testcase_04 AC 157 ms
42,720 KB
testcase_05 AC 149 ms
42,752 KB
testcase_06 AC 143 ms
42,624 KB
testcase_07 AC 154 ms
42,624 KB
testcase_08 AC 171 ms
42,584 KB
testcase_09 AC 167 ms
42,604 KB
testcase_10 AC 164 ms
42,636 KB
testcase_11 AC 161 ms
42,624 KB
testcase_12 AC 156 ms
42,620 KB
testcase_13 AC 164 ms
42,680 KB
testcase_14 AC 180 ms
42,492 KB
testcase_15 AC 159 ms
42,508 KB
testcase_16 AC 164 ms
42,752 KB
testcase_17 AC 153 ms
42,528 KB
testcase_18 AC 155 ms
42,624 KB
testcase_19 AC 168 ms
42,576 KB
testcase_20 AC 172 ms
42,628 KB
testcase_21 AC 159 ms
42,516 KB
testcase_22 AC 157 ms
42,588 KB
testcase_23 AC 147 ms
42,496 KB
testcase_24 AC 155 ms
42,644 KB
testcase_25 AC 156 ms
42,468 KB
testcase_26 AC 158 ms
42,656 KB
testcase_27 AC 163 ms
42,496 KB
testcase_28 AC 167 ms
42,620 KB
testcase_29 AC 173 ms
42,548 KB
testcase_30 AC 172 ms
42,752 KB
testcase_31 AC 175 ms
42,752 KB
testcase_32 AC 180 ms
42,624 KB
testcase_33 AC 172 ms
42,600 KB
testcase_34 AC 165 ms
42,704 KB
testcase_35 AC 178 ms
42,576 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |     scanf("%d%d",&N,&L);
      |     ~~~~~^~~~~~~~~~~~~~

ソースコード

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