結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー rapurasurapurasu
提出日時 2016-08-05 22:52:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 97 ms / 1,000 ms
コード長 733 bytes
コンパイル時間 1,168 ms
コンパイル使用メモリ 143,556 KB
実行使用メモリ 13,356 KB
最終ジャッジ日時 2023-08-22 03:42:58
合計ジャッジ時間 3,797 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 7 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 92 ms
12,732 KB
testcase_06 AC 41 ms
9,496 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 7 ms
4,380 KB
testcase_20 AC 24 ms
7,576 KB
testcase_21 AC 9 ms
4,924 KB
testcase_22 AC 8 ms
4,428 KB
testcase_23 AC 15 ms
5,220 KB
testcase_24 AC 23 ms
7,444 KB
testcase_25 AC 38 ms
9,504 KB
testcase_26 AC 39 ms
9,488 KB
testcase_27 AC 5 ms
4,376 KB
testcase_28 AC 17 ms
7,456 KB
testcase_29 AC 37 ms
9,480 KB
testcase_30 AC 6 ms
4,380 KB
testcase_31 AC 30 ms
7,496 KB
testcase_32 AC 37 ms
9,540 KB
testcase_33 AC 97 ms
13,176 KB
testcase_34 AC 94 ms
13,356 KB
testcase_35 AC 81 ms
12,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
bool is_prime[10000001];

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