結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー ldsybldsyb
提出日時 2016-08-06 00:11:38
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 61 ms / 1,000 ms
コード長 375 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 64,972 KB
実行使用メモリ 13,360 KB
最終ジャッジ日時 2023-08-22 04:32:16
合計ジャッジ時間 3,878 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
13,096 KB
testcase_01 AC 60 ms
13,360 KB
testcase_02 AC 59 ms
13,100 KB
testcase_03 AC 61 ms
13,152 KB
testcase_04 AC 56 ms
13,224 KB
testcase_05 AC 55 ms
13,240 KB
testcase_06 AC 56 ms
13,116 KB
testcase_07 AC 58 ms
13,144 KB
testcase_08 AC 57 ms
13,160 KB
testcase_09 AC 58 ms
13,216 KB
testcase_10 AC 55 ms
13,092 KB
testcase_11 AC 58 ms
13,100 KB
testcase_12 AC 57 ms
13,092 KB
testcase_13 AC 54 ms
13,116 KB
testcase_14 AC 55 ms
13,116 KB
testcase_15 AC 59 ms
13,144 KB
testcase_16 AC 59 ms
13,120 KB
testcase_17 AC 58 ms
13,172 KB
testcase_18 AC 57 ms
13,128 KB
testcase_19 AC 58 ms
13,100 KB
testcase_20 AC 56 ms
13,088 KB
testcase_21 AC 58 ms
13,288 KB
testcase_22 AC 59 ms
13,100 KB
testcase_23 AC 56 ms
13,148 KB
testcase_24 AC 58 ms
13,284 KB
testcase_25 AC 57 ms
13,152 KB
testcase_26 AC 55 ms
13,176 KB
testcase_27 AC 56 ms
13,148 KB
testcase_28 AC 57 ms
13,200 KB
testcase_29 AC 54 ms
13,092 KB
testcase_30 AC 55 ms
13,096 KB
testcase_31 AC 56 ms
13,096 KB
testcase_32 AC 58 ms
13,116 KB
testcase_33 AC 60 ms
13,104 KB
testcase_34 AC 59 ms
13,144 KB
testcase_35 AC 60 ms
13,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

bool prime[int(1e7) + 1];

void makeprime(){for(int i = 2;i * i <= 1e7 + 1;i++) if(!prime[i]) for(int j = 2 * i;j < int(1e7) + 1;j += i) prime[j] = true;}

int main(){
	makeprime();
	long long ans = 0,n,l;
	cin >> n >> l;
	for(int i = 2;i < int(1e7) + 1;i++) if(!prime[i]) ans += max(0ll,l - (n - 1) * i + 1);
	cout << ans << endl;
}
0