結果

問題 No.371 ぼく悪いプライムじゃないよ
ユーザー satanicsatanic
提出日時 2016-05-13 23:19:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,249 bytes
コンパイル時間 1,544 ms
コンパイル使用メモリ 164,960 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-15 16:56:39
合計ジャッジ時間 4,967 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
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 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 5 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 725 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define VAR(type, a) type a;std::cin>>a;
// VAR(int, x);
#define OUT(d) std::cout<<(d);
#define SP std::cout<<" ";
#define ENDL std::cout<<"\n";
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using ll = long long;

ll PrimeFactMin(ll n){
	double sqrtn = std::sqrt(n);
	for(ll i=2; i<=sqrtn; ++i){
		int divCount = 0;
		if(n%i == 0){
			do{
				++divCount;
				n/=i;
			}while(n%i == 0);
		    return i;
		}
	}
    return n;
}

int main(){
    INIT;
    VAR(ll, l);VAR(ll, h);
    ll ans = -1;
    ll primeMin = -1;
    int below = std::max(static_cast<ll>(std::sqrt(h)), l);
    FOR(i, below, h+1){
        ll t = PrimeFactMin(i);
        if(i!=t && primeMin<=t){
            primeMin = t;
            ans = i;
        }
        //OUT(i)SP OUT(t)ENDL;
    }
    OUT(ans)ENDL;
    return 0;
}
0