結果
| 問題 | No.407 鴨等素数間隔列の数え上げ |
| コンテスト | |
| ユーザー |
okayunonaha
|
| 提出日時 | 2016-08-06 01:11:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 590 bytes |
| 記録 | |
| コンパイル時間 | 581 ms |
| コンパイル使用メモリ | 54,484 KB |
| 実行使用メモリ | 42,368 KB |
| 最終ジャッジ日時 | 2024-11-07 01:10:51 |
| 合計ジャッジ時間 | 12,669 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 27 TLE * 4 |
ソースコード
#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;
}
okayunonaha