結果

問題 No.371 ぼく悪いプライムじゃないよ
ユーザー kotatsugamekotatsugame
提出日時 2020-04-22 23:01:23
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 472 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 64,624 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2024-04-20 12:44:31
合計ジャッジ時間 2,179 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
5,248 KB
testcase_01 AC 8 ms
5,376 KB
testcase_02 AC 7 ms
5,376 KB
testcase_03 AC 7 ms
5,376 KB
testcase_04 AC 7 ms
5,376 KB
testcase_05 AC 8 ms
5,376 KB
testcase_06 AC 8 ms
5,376 KB
testcase_07 AC 8 ms
5,376 KB
testcase_08 AC 7 ms
5,376 KB
testcase_09 AC 7 ms
5,376 KB
testcase_10 AC 8 ms
5,376 KB
testcase_11 AC 7 ms
5,376 KB
testcase_12 AC 7 ms
5,376 KB
testcase_13 AC 7 ms
5,376 KB
testcase_14 AC 7 ms
5,376 KB
testcase_15 AC 7 ms
5,376 KB
testcase_16 AC 7 ms
5,376 KB
testcase_17 AC 7 ms
5,376 KB
testcase_18 AC 7 ms
5,376 KB
testcase_19 AC 7 ms
5,376 KB
testcase_20 AC 20 ms
8,320 KB
testcase_21 AC 7 ms
5,376 KB
testcase_22 AC 22 ms
8,576 KB
testcase_23 AC 8 ms
5,376 KB
testcase_24 AC 17 ms
6,912 KB
testcase_25 AC 22 ms
8,576 KB
testcase_26 AC 7 ms
5,376 KB
testcase_27 AC 7 ms
5,376 KB
testcase_28 AC 7 ms
5,376 KB
testcase_29 AC 12 ms
5,504 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 22 ms
8,704 KB
testcase_42 AC 23 ms
8,576 KB
testcase_43 AC 10 ms
5,376 KB
testcase_44 AC 7 ms
5,376 KB
testcase_45 AC 8 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
long L,H;
int divv[1<<20];
bool isp[1<<20];
main()
{
	cin>>L>>H;
	if(L+(1<<20)<=H)L=H-(1<<20)+1;
	for(int i=2;i<1<<20;i++)isp[i]=true;
	for(int i=2;i<1<<20;i++)if(isp[i])
	{
		for(int j=i+i;j<1<<20;j+=i)isp[j]=false;
		long X=(L+i-1)/i*i;
		if(X==i)X+=i;
		for(;X<=H;X+=i)if(divv[H-X]==0)divv[H-X]=i;
	}
	long ans=L;
	if(divv[H-ans]==0)ans++;
	for(long i=ans+1;i<=H;i++)
	{
		if(divv[H-ans]<=divv[H-i])ans=i;
	}
	cout<<ans<<endl;
}
0