結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー okayunonahaokayunonaha
提出日時 2016-08-06 01:11:41
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 590 bytes
コンパイル時間 545 ms
コンパイル使用メモリ 54,616 KB
実行使用メモリ 42,368 KB
最終ジャッジ日時 2024-04-24 16:31:15
合計ジャッジ時間 11,912 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 36 ms
7,168 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 TLE -
testcase_06 AC 557 ms
23,808 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 37 ms
7,168 KB
testcase_20 AC 203 ms
15,104 KB
testcase_21 AC 50 ms
8,448 KB
testcase_22 AC 40 ms
7,552 KB
testcase_23 AC 92 ms
10,880 KB
testcase_24 AC 188 ms
15,232 KB
testcase_25 AC 568 ms
23,040 KB
testcase_26 AC 541 ms
22,912 KB
testcase_27 AC 26 ms
6,272 KB
testcase_28 AC 113 ms
11,904 KB
testcase_29 AC 473 ms
22,400 KB
testcase_30 AC 31 ms
6,784 KB
testcase_31 AC 303 ms
18,944 KB
testcase_32 AC 497 ms
22,656 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int x[10000010];
void sosu(int n, int l) {
	for (int i = 2; i <= l; i++) {
		for (int j = 2; i*j <= l; j++) {
			x[i * j] = 1;
		}
	}
	/*for (int i = 2; i <= l; i++) {
	if(!x[i]) cout << i << " ";
	}
	cout << endl;
	*/
}
int main(void) {
	long long int tmp, N, L, d, round = 0, ans = 1;
	cin.tie(0);
	cin >> N >> L;
	sosu(N,L);

	for (int i = 2; ; i++) {
		if(!x[i]){ d = i;
		tmp = (i-1) * (N-1)+N;
		if(tmp > L+1) break;
		else tmp = L+1 - tmp + 1;
		round += tmp;
		}
	}

	if(ans) cout << round << endl;
	//else cout << 0 << endl;

	return 0;
}
0