結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー Y17Y17
提出日時 2018-10-07 19:18:08
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 450 bytes
コンパイル時間 1,483 ms
コンパイル使用メモリ 158,692 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 18:17:03
合計ジャッジ時間 5,522 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
5,248 KB
testcase_01 AC 8 ms
5,376 KB
testcase_02 AC 7 ms
5,376 KB
testcase_03 AC 9 ms
5,376 KB
testcase_04 AC 8 ms
5,376 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 8 ms
5,376 KB
testcase_08 AC 7 ms
5,376 KB
testcase_09 AC 8 ms
5,376 KB
testcase_10 AC 8 ms
5,376 KB
testcase_11 AC 8 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 7 ms
5,376 KB
testcase_14 AC 8 ms
5,376 KB
testcase_15 AC 7 ms
5,376 KB
testcase_16 AC 8 ms
5,376 KB
testcase_17 AC 7 ms
5,376 KB
testcase_18 AC 8 ms
5,376 KB
testcase_19 AC 10 ms
5,376 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 WA -
testcase_28 RE -
testcase_29 RE -
testcase_30 WA -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

bool memo[1000010];

int main(){
  int n, l;
  cin >> n >> l;
  memset(memo,true,sizeof(memo));
  memo[1] = false;

  for(int i = 2;i < 1000010;i++){
    if(memo[i]){
      for(int j = i*2; j < 1000010;j+=i){
        memo[j] = false;
      }
    }
  }

  long long ans = 0;
  for(int i = 2;i <= l;i++){
    if(memo[i]){
      ans += max(l-i*(n-1)+1, 0);
    }
  }
  cout << ans << endl;
  return 0;
}


0