結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー 👑 kmjpkmjp
提出日時 2016-08-05 22:26:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 163 ms / 1,000 ms
コード長 1,091 bytes
コンパイル時間 1,883 ms
コンパイル使用メモリ 145,252 KB
実行使用メモリ 50,756 KB
最終ジャッジ日時 2023-08-22 02:22:33
合計ジャッジ時間 7,446 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
50,448 KB
testcase_01 AC 132 ms
50,468 KB
testcase_02 AC 128 ms
50,448 KB
testcase_03 AC 127 ms
50,456 KB
testcase_04 AC 132 ms
50,452 KB
testcase_05 AC 137 ms
50,464 KB
testcase_06 AC 131 ms
50,448 KB
testcase_07 AC 126 ms
50,464 KB
testcase_08 AC 129 ms
50,568 KB
testcase_09 AC 163 ms
50,644 KB
testcase_10 AC 129 ms
50,444 KB
testcase_11 AC 134 ms
50,648 KB
testcase_12 AC 143 ms
50,448 KB
testcase_13 AC 136 ms
50,756 KB
testcase_14 AC 140 ms
50,696 KB
testcase_15 AC 130 ms
50,440 KB
testcase_16 AC 131 ms
50,468 KB
testcase_17 AC 130 ms
50,444 KB
testcase_18 AC 131 ms
50,452 KB
testcase_19 AC 133 ms
50,500 KB
testcase_20 AC 130 ms
50,472 KB
testcase_21 AC 133 ms
50,464 KB
testcase_22 AC 130 ms
50,448 KB
testcase_23 AC 129 ms
50,464 KB
testcase_24 AC 139 ms
50,588 KB
testcase_25 AC 134 ms
50,460 KB
testcase_26 AC 130 ms
50,512 KB
testcase_27 AC 130 ms
50,448 KB
testcase_28 AC 128 ms
50,644 KB
testcase_29 AC 128 ms
50,508 KB
testcase_30 AC 131 ms
50,532 KB
testcase_31 AC 135 ms
50,444 KB
testcase_32 AC 133 ms
50,452 KB
testcase_33 AC 143 ms
50,716 KB
testcase_34 AC 140 ms
50,512 KB
testcase_35 AC 132 ms
50,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N,L;

const int prime_max = 11000000;
int NP,prime[1100000],divp[prime_max];

void cprime() {
	for(int i=2;i<prime_max;i++) if(divp[i]==0) {
		//M[i]=NP;
		prime[NP++]=i;
		for(ll j=1LL*i*i;j>i&&j<prime_max;j+=i) divp[j]=i;
	}
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cprime();
	
	cin>>N>>L;
	ll ret=0;
	for(i=2;i<=L;i++) if(divp[i]==0) {
		int a=i*(N-1);
		if(a>L) break;
		ret += L+1-a;
	}
	cout<<ret<<endl;
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}
0