結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー konsin_tokage
提出日時 2018-05-30 12:33:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 300 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 58,940 KB
実行使用メモリ 42,240 KB
最終ジャッジ日時 2024-06-30 08:11:51
合計ジャッジ時間 3,002 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 18 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(){
    int l,n;
    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;
    long long int r=0;
    for(int i=2;i<l;++i)if(s[i])r+=max(0,l-i*(n-1)+1);
    cout<<r<<endl;
    return 0;
}
0