CF483A.Counterexample

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Your friend has recently learned about coprime numbers. A pair of numbers {a, b} is called coprime if the maximum number that divides both a and b is equal to one.

Your friend often comes up with different statements. He has recently supposed that if the pair (a, b) is coprime and the pair (b, c) is coprime, then the pair (a, c) is coprime.

You want to find a counterexample for your friend's statement. Therefore, your task is to find three distinct numbers (a, b, c), for which the statement is false, and the numbers meet the condition l ≤ a < b < c ≤ r.

More specifically, you need to find three numbers (a, b, c), such that l ≤ a < b < c ≤ r, pairs (a, b) and (b, c) are coprime, and pair (a, c) is not coprime.

你的朋友最近学习了互质数的概念。若一对数 {a, b}\{a,\,b\} 的最大公约数为 11,则称这对数互质。

你的朋友经常提出各种命题。他最近猜想:若 (a, b)(a,\,b) 互质且 (b, c)(b,\,c) 互质,则 (a, c)(a,\,c) 也互质。

你想为朋友的这个命题找到一个反例。因此,你的任务是找出三个互不相同的整数 (a, b, c)(a,\,b,\,c),使得该命题不成立,且满足条件 l ≤ a < b < c ≤ rl \le a < b < c \le r。

更具体地说,你需要找出三个数 (a, b, c)(a,\,b,\,c),满足 l ≤ a < b < c ≤ rl \le a < b < c \le r,其中 (a, b)(a,\,b) 和 (b, c)(b,\,c) 均互质,但 (a, c)(a,\,c) 不互质。

输入格式

The single line contains two positive space-separated integers l, r (1 ≤ l ≤ r ≤ 1018; r - l ≤ 50).

单行包含两个用空格分隔的正整数 ll、rr(1 ≤ l ≤ r ≤ 10181 ≤ l ≤ r ≤ 10^{18};r − l ≤ 50r - l ≤ 50)。

输出格式

Print three positive space-separated integers a, b, c — three distinct numbers (a, b, c) that form the counterexample. If there are several solutions, you are allowed to print any of them. The numbers must be printed in ascending order.

If the counterexample does not exist, print the single number -1.

输出三个正整数 aa、bb、cc,以空格分隔——这三个互不相同的数 (a, b, c)(a,\,b,\,c) 构成反例。若存在多个解,任选其一输出即可。所输出的数字必须按升序排列。

若不存在这样的反例,则仅输出单个数字 −1-1。

输入输出样例

  • 输入#1

    2 4

    输出#1

    2 3 4
  • 输入#2

    10 11

    输出#2

    -1
  • 输入#3

    900000000000000009 900000000000000029

    输出#3

    900000000000000009 900000000000000010 900000000000000021

说明/提示

In the first sample pair (2, 4) is not coprime and pairs (2, 3) and (3, 4) are.

In the second sample you cannot form a group of three distinct integers, so the answer is -1.

In the third sample it is easy to see that numbers 900000000000000009 and 900000000000000021 are divisible by three.

在第一个样例中,数对 (2, 4) 不互质,而数对 (2, 3) 和 (3, 4) 互质。

在第二个样例中,无法构成三个互不相同的整数的集合,因此答案为 -1。

在第三个样例中,容易看出数字 900000000000000009900000000000000009 和 900000000000000021900000000000000021 均能被 33 整除。

输入解题思路,AI测评打分。不知道怎么写?

首页