結果
| 問題 | No.3485 Find 495-like Number |
| コンテスト | |
| ユーザー |
hiromi_ayase
|
| 提出日時 | 2026-03-27 22:49:52 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,276 bytes |
| 記録 | |
| コンパイル時間 | 6,163 ms |
| コンパイル使用メモリ | 375,372 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2026-03-27 22:50:08 |
| 合計ジャッジ時間 | 14,549 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 5 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;
vector<i64> getPrimes(int n) {
vector<bool> isPrime(n + 1, true);
isPrime[0] = isPrime[1] = false;
for (int i = 2; i <= n; i ++) {
if (isPrime[i]) {
for (int j = i + i; j <= n; j += i) {
isPrime[j] = false;
}
}
}
vector<i64> primes;
for (int i = 3; i <= n; i ++) {
if (isPrime[i]) {
primes.push_back(i);
}
}
return primes;
}
int main() {
FAST_IO
i64 L, R;
cin >> L >> R;
auto primes = getPrimes(10000);
int m = primes.size();
for (int i = 0; i < m; i ++) {
auto a = primes[i];
if (a * a * a * a >= R) break;
for (int j = i + 1; j < m; j ++) {
auto b = primes[j];
if (a * a * b * b >= R) break;
for (int k = j + 1; k < m; k ++) {
auto c = primes[k];
auto x = a * a * b * c;
if(L <= x && x <= R) {
cout << x << endl;
return 0;
}
}
}
}
cout << -1 << endl;
return 0;
}
hiromi_ayase