結果
| 問題 |
No.407 鴨等素数間隔列の数え上げ
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-19 21:34:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 126 ms / 1,000 ms |
| コード長 | 467 bytes |
| コンパイル時間 | 1,917 ms |
| コンパイル使用メモリ | 194,028 KB |
| 最終ジャッジ日時 | 2025-01-09 07:57:37 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 31 |
ソースコード
#include<bits/stdc++.h>
using lint=long long;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
lint d,n;std::cin>>d>>n;d--;
std::vector<lint>sieve(n+1);
lint ans=0;
for(lint i=2;i<=n/d;i++){
if(sieve.at(i))continue;
ans+=n-i*d+1;
for(lint j=i*i;j<=n/d;j+=i){
sieve.at(j)=true;
}
}
std::cout<<ans<<'\n';
}
ngtkana