問題一覧 > 通常問題

No.3485 Find 495-like Number

レベル : / AI推定難易度 : 1750 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 29
作問者 : 👑 AngrySadEight / テスター : 👑 binap 👑 hamamu
お気に入りにしたユーザー ProblemId : 12882 / 自分の提出
問題文最終更新日: 2026-03-27 13:23:33
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 495 (順位表) の他の問題:

Problem Statement

An integer that can be expressed as $n = a^2bc$ using odd primes $a, b, c$ satisfying $a < b < c$, such as $495 = 3^2 \times 5 \times 11$, is called a 495-like number.

You are given positive integers $L, R(L \leq R)$. Determine whether there exists an integer $x$ satisfying $L \leq x \leq R$ that is a 495-like number, and if one exists, find $1$ such integer.

Constraints

  • All inputs are integers.
  • $1 \leq L \leq R \leq 4.95 \times 10^{14}$

Input

The input is given from standard input in the following format.

$L$ $R$

Output

If there exists a 495-like number $x$ satisfying $L \leq x \leq R$, print $1$ such number; otherwise, print $-1$. If there are multiple values of $x$ satisfying the condition, any of them will be accepted.

Sample

Sample 1
Input
485 505
Output
495

$495 = 3^2 \times 5 \times 11$, which is a 495-like Number, so print $495$.

Note that $492 = 2^2 \times 3 \times 41$ is not a 495-like Number because $a = 2$ is not an odd prime.

Sample 2
Input
1 100
Output
-1

There is no 495-like Number among the integers between $1$ and $100$, inclusive. Therefore, print $-1$.

Sample 3
Input
494000000000000 495000000000000
Output
494000000000001

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。