結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー RIGIHRIGIH
提出日時 2017-06-27 03:13:54
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 410 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 58,840 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 02:12:08
合計ジャッジ時間 4,561 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #


#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;
}
0