A9760 | Counterexample
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
The single line contains two positive space-separated integers $l$ , $r$ ( $1<=l<=r<=10^{18}$ ; $r-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.
If the counterexample does not exist, print the single number -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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted