結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー kotatsugamekotatsugame
提出日時 2016-10-30 04:32:47
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 53 ms / 1,000 ms
コード長 411 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 69,420 KB
実行使用メモリ 9,968 KB
最終ジャッジ日時 2023-08-22 06:41:34
合計ジャッジ時間 2,171 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 5 ms
4,376 KB
testcase_20 AC 16 ms
5,060 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 28 ms
6,564 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 13 ms
4,900 KB
testcase_33 AC 52 ms
9,968 KB
testcase_34 AC 53 ms
9,912 KB
testcase_35 AC 24 ms
6,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include<vector>
using namespace std;

int main() {
	long long int sum=0;
	vector<int> p;
	int n,l;
	cin>>n>>l;
	bool *isp=new bool[l/(n-1)+1];
	for(int i=1;i<l/(n-1)+1;i++)isp[i]=true;
	for(int i=2;i<l/(n-1)+1;i++)
	{
		if(isp[i])
		{
			p.push_back(i);
			for(int j=2;j<=l/(i*(n-1));j++)isp[i*j]=false;
		}
	}
	for(int i=0;i<p.size();i++)sum+=l-p[i]*(n-1)+1;
	cout<<sum<<endl;
	return 0;
}
0