結果
| 問題 |
No.407 鴨等素数間隔列の数え上げ
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2023-07-17 02:05:24 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 81 ms / 1,000 ms |
| コード長 | 614 bytes |
| コンパイル時間 | 3,820 ms |
| コンパイル使用メモリ | 139,512 KB |
| 実行使用メモリ | 13,260 KB |
| 最終ジャッジ日時 | 2024-09-17 21:10:21 |
| 合計ジャッジ時間 | 5,400 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 31 |
ソースコード
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>
using namespace std;
typedef long long ll;
bool checked[10000010];
int main() {
ll N, L;
cin >> N >> L;
memset(checked, false, sizeof(checked));
ll ans = 0;
for (ll l = 2; l <= L; ++l) {
if (checked[l]) continue;
for (ll x = l; x <= L; x += l) {
checked[x] = true;
}
ll a = L - l * (N - 1) + 1;
if (a <= 0) break;
ans += a;
}
cout << ans << endl;
return 0;
}
siman