結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー tabataba
提出日時 2017-05-19 02:04:51
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 582 bytes
コンパイル時間 1,124 ms
コンパイル使用メモリ 113,276 KB
実行使用メモリ 7,616 KB
最終ジャッジ日時 2023-10-18 23:18:03
合計ジャッジ時間 3,739 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <random>
#include <vector>
#include <algorithm>
#include <array>
#include <functional>
#include <utility>
#include <regex>
#include <tuple>
#include <map>

using namespace std;

int main(){
	int n,l;
	int64_t cnt=0;
	-scanf("%d%d",&n,&l);
	vector<int> prime;
	prime.push_back(2);
	for(int i=3;i<l;i+=2){
		if(all_of(prime.begin(),prime.end(),[i](int p){return i%p;})){
			prime.push_back(i);
		}
	}
	for(int p=0;(n-1)*prime[p]<=l;p++){
		cnt+=l-(n-1)*prime[p]+1;
	}
	printf("%ld\n",cnt);
	return 0;
}
0