結果
| 問題 |
No.407 鴨等素数間隔列の数え上げ
|
| コンテスト | |
| ユーザー |
RIGIH
|
| 提出日時 | 2017-06-27 01:46:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 559 bytes |
| コンパイル時間 | 482 ms |
| コンパイル使用メモリ | 59,544 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-10-04 10:00:35 |
| 合計ジャッジ時間 | 4,652 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 2 |
| other | AC * 13 WA * 6 TLE * 2 -- * 10 |
ソースコード
#include<stdio.h>
#include <iostream>
#include <cstring>
#include <math.h>
using namespace std;
long long sosu(long long);
int main(){
long long n,a;
cin>>n>>a;
long long m=0;
/*for(long long d=2 ; d <= a/(n-1) ; d++){
if(sosu(d)==1){
m=m+a-(n-1)*d+1;
}
}*/
m=m+a-(n-1)*2+1;
for(long long d=3 ; d <= a/(n-1) ; d+=2){
if(sosu(d)==1){
m=m+a-(n-1)*d+1;
}
}
cout<<m<<endl;
return 0;
}
long long sosu(long long n){
if (n==1) return 0;
long long i;
for(i=2;i*i<=n;i++) if(n%i==0) return 0;
return 1;
}
RIGIH