結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー aaaaaaaaaa
提出日時 2017-11-11 01:24:07
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 843 bytes
コンパイル時間 982 ms
コンパイル使用メモリ 72,048 KB
実行使用メモリ 28,160 KB
最終ジャッジ日時 2024-05-03 15:15:29
合計ジャッジ時間 7,436 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 2 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 WA -
testcase_24 AC 1 ms
5,376 KB
testcase_25 TLE -
testcase_26 WA -
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 WA -
testcase_30 AC 2 ms
5,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 TLE -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define p pair<int,int>
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
using namespace std;

int main(){
	
	int n,l;
	cin>>n>>l;
	int x=l/(n-1);
	vector<int> d(x+1);
	rep(i,x+1){
		d[i]=1;
	}
	for(int i=2;i*i<=x;i++){
		if(d[i]==1){
			FOR(j,i+1,x+1){
				if(j%i==0)d[j]=0;
			}
		}
	}
	/*FOR(i,2,x+1){
		if(d[i]==1){
			printf("%d\n",i);
		}
	}*/

	ll ans=0;
	FOR(i,2,x+1){
		ans+=l-(n-1)*d[i]*i+1;
	}
	cout<<ans<<endl;

	return 0;
}
0