結果
問題 |
No.407 鴨等素数間隔列の数え上げ
|
ユーザー |
![]() |
提出日時 | 2017-06-27 03:13:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 410 bytes |
コンパイル時間 | 413 ms |
コンパイル使用メモリ | 59,828 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-04 10:17:18 |
合計ジャッジ時間 | 3,916 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 RE * 2 |
other | AC * 10 RE * 21 |
ソースコード
#include<stdio.h> #include <iostream> #include <cstring> #include <math.h> using namespace std; int main(){ long long n,a; cin>>n>>a; int x=a/(n-1); long ds=0; int z=0; int *s; s=new int[x/2+3]; int sk=0; for(int d=2;d<=x;d++){ int i; for(i=0; i<sk ;i++) {if(d%s[i]==0) goto no;} s[++sk]=d; ds+=d; z++; no:; } cout<<(a+1)*z-(n-1)*ds<<endl; return 0; }