結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー beetbeet
提出日時 2018-07-30 14:17:47
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 97 ms / 1,000 ms
コード長 377 bytes
コンパイル時間 1,410 ms
コンパイル使用メモリ 165,216 KB
実行使用メモリ 13,368 KB
最終ジャッジ日時 2023-10-11 20:36:55
合計ジャッジ時間 6,520 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
13,088 KB
testcase_01 AC 96 ms
13,144 KB
testcase_02 AC 96 ms
13,092 KB
testcase_03 AC 94 ms
13,132 KB
testcase_04 AC 94 ms
13,080 KB
testcase_05 AC 93 ms
13,096 KB
testcase_06 AC 93 ms
13,296 KB
testcase_07 AC 95 ms
13,096 KB
testcase_08 AC 94 ms
13,272 KB
testcase_09 AC 94 ms
13,156 KB
testcase_10 AC 94 ms
13,200 KB
testcase_11 AC 93 ms
13,072 KB
testcase_12 AC 94 ms
13,152 KB
testcase_13 AC 94 ms
13,092 KB
testcase_14 AC 93 ms
13,096 KB
testcase_15 AC 93 ms
13,080 KB
testcase_16 AC 94 ms
13,144 KB
testcase_17 AC 93 ms
13,080 KB
testcase_18 AC 95 ms
13,088 KB
testcase_19 AC 95 ms
13,092 KB
testcase_20 AC 93 ms
13,296 KB
testcase_21 AC 96 ms
13,100 KB
testcase_22 AC 95 ms
13,096 KB
testcase_23 AC 93 ms
13,088 KB
testcase_24 AC 93 ms
13,148 KB
testcase_25 AC 93 ms
13,156 KB
testcase_26 AC 93 ms
13,364 KB
testcase_27 AC 97 ms
13,156 KB
testcase_28 AC 94 ms
13,088 KB
testcase_29 AC 93 ms
13,200 KB
testcase_30 AC 94 ms
13,092 KB
testcase_31 AC 93 ms
13,272 KB
testcase_32 AC 95 ms
13,084 KB
testcase_33 AC 94 ms
13,156 KB
testcase_34 AC 95 ms
13,096 KB
testcase_35 AC 93 ms
13,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
const Int MAX = 1e7+1000;
bool dp[MAX];
signed main(){
  Int n,l;
  cin>>n>>l;
  Int ans=0;
  memset(dp,0,sizeof(dp));
  for(Int i=2;i<MAX;i++){
    if(dp[i]) continue;
    for(Int j=i+i;j<MAX;j+=i) dp[j]=1;
    Int x=i*(n-1);
    ans+=max(0LL,l-x+1);
  }
  cout<<ans<<endl;
  return 0;
}
0