結果
問題 |
No.407 鴨等素数間隔列の数え上げ
|
ユーザー |
![]() |
提出日時 | 2025-07-27 13:31:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 409 bytes |
コンパイル時間 | 1,883 ms |
コンパイル使用メモリ | 194,196 KB |
実行使用メモリ | 12,088 KB |
最終ジャッジ日時 | 2025-07-27 13:31:11 |
合計ジャッジ時間 | 5,009 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 4 |
other | WA * 31 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define int ll const int N=2e6+7; int n,m,res=0,pr[N],tot=0; bitset<10000007>vis; signed main(){ cin>>n>>m; vis[0]=vis[1]=1; for(int i=2;i<=m;i++){ if(!vis[i])pr[++tot]=i; for(int j=1;j<=tot&&pr[j]*i<=m;j++){ vis[pr[j]*i]=1; if(i%pr[j]==0)break; } } for(int i=1;i<=tot;i++)res+=max(0ll,m-pr[i]*(n-1))+1; cout<<res<<"\n"; }