結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー snrnsidysnrnsidy
提出日時 2021-06-15 00:58:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 632 bytes
コンパイル時間 1,819 ms
コンパイル使用メモリ 199,936 KB
実行使用メモリ 5,228 KB
最終ジャッジ日時 2023-08-26 15:27:28
合計ジャッジ時間 3,427 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
5,012 KB
testcase_01 AC 7 ms
5,096 KB
testcase_02 AC 7 ms
5,156 KB
testcase_03 AC 8 ms
4,996 KB
testcase_04 AC 7 ms
5,056 KB
testcase_05 AC 7 ms
5,004 KB
testcase_06 AC 7 ms
5,060 KB
testcase_07 AC 8 ms
5,144 KB
testcase_08 AC 8 ms
5,228 KB
testcase_09 AC 7 ms
5,036 KB
testcase_10 AC 8 ms
5,040 KB
testcase_11 AC 8 ms
5,008 KB
testcase_12 AC 7 ms
5,060 KB
testcase_13 AC 8 ms
4,996 KB
testcase_14 AC 8 ms
5,056 KB
testcase_15 AC 8 ms
5,000 KB
testcase_16 AC 7 ms
5,060 KB
testcase_17 AC 8 ms
5,004 KB
testcase_18 AC 7 ms
5,092 KB
testcase_19 AC 8 ms
5,028 KB
testcase_20 WA -
testcase_21 AC 8 ms
5,128 KB
testcase_22 AC 7 ms
5,036 KB
testcase_23 AC 8 ms
5,064 KB
testcase_24 AC 8 ms
5,028 KB
testcase_25 WA -
testcase_26 AC 8 ms
5,028 KB
testcase_27 AC 7 ms
5,052 KB
testcase_28 AC 7 ms
5,060 KB
testcase_29 AC 8 ms
5,088 KB
testcase_30 AC 7 ms
5,004 KB
testcase_31 AC 8 ms
5,060 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

vector <long long int> prime;

void eratos()
{
	bool isprime[1000005];
	memset(isprime, true, sizeof(isprime));
	for (int i = 2; i <= 1000000; i++)
	{
		if (isprime[i])
		{
			prime.push_back(i);
			for (int j = 2 * i; j <= 1000000; j += i)
			{
				isprime[j] = false;
			}
		}
	}
}
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	long long int N, L;
	long long int res = 0;

	cin >> N >> L;

	eratos();

	for (int i = 0; i < prime.size(); i++)
	{
		long long int val = L - (N - 1) * prime[i];
		if (val >= 0) res += (val + 1);
	}

	cout << res << '\n';

	return 0;
}
0