結果
| 問題 | No.407 鴨等素数間隔列の数え上げ |
| コンテスト | |
| ユーザー |
konsin_tokage
|
| 提出日時 | 2018-05-30 12:40:38 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 148 ms / 1,000 ms |
| コード長 | 306 bytes |
| 記録 | |
| コンパイル時間 | 635 ms |
| コンパイル使用メモリ | 76,524 KB |
| 実行使用メモリ | 42,400 KB |
| 最終ジャッジ日時 | 2026-03-20 03:26:04 |
| 合計ジャッジ時間 | 2,739 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 31 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
#define ll long long int
int main(){
ll n,l,r=0;
cin>>n>>l;
vector<int> s(l,1);
for(int i=2;i*i<l;++i)if(s[i])for(int j=i+i;j<l;j+=i)s[j]=0;
for(ll i=2;i<l;++i)if(s[i])r+=max(0LL,l-i*(n-1)+1);
cout<<r<<endl;
return 0;
}
konsin_tokage