結果

問題 No.3485 Find 495-like Number
コンテスト
ユーザー 👑 AngrySadEight
提出日時 2025-12-07 11:46:45
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 765 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 713 ms
コンパイル使用メモリ 89,580 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2026-03-27 20:50:56
合計ジャッジ時間 7,969 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 1 -- * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

bool judges(ll X){
    vector<ll> divs;
    ll xcpy = X;
    for (ll i = 2; i * i <= X; i++){
        while (xcpy % i == 0){
            divs.push_back(i);
            xcpy /= i;
        }
    }
    if (xcpy != 1){
        divs.push_back(xcpy);
    }
    if (divs.size() != 4){
        return false;
    }
    if (divs[0] == 2){
        return false;
    }
    else if (!(divs[0] == divs[1] && divs[1] != divs[2] && divs[2] != divs[3])){
        return false;
    }
    return true;
}

int main(){
    ll L, R;
    cin >> L >> R;

    for (ll i = L; i <= R; i++){
        if (judges(i)){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}
0