传送门

Description

Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction   as a sum of three distinct positive fractions in form .

Help Vladik with that, i.e for a given n find three distinct positive integers xy and z such that  . Because Chloe can't check Vladik's answer if the numbers are large, he asks you to print numbers not exceeding 109.

If there is no such answer, print -1.

Input

The single line contains single integer n (1 ≤ n ≤ 104).

Output

If the answer exists, print 3 distinct numbers xy and z (1 ≤ x, y, z ≤ 109x ≠ yx ≠ zy ≠ z). Otherwise print -1.

If there are multiple answers, print any of them.

Sample Input

3

7

Sample Output

2 7 42

7 8 56

思路

题意:

给出一个数 n ,问是否存在三个不同的整数 x ,y ,z 满足

题解:

,因此,我们可以让1/z = 1 / n,剩下的为 1/x + 1/y = 1/n,通过恒等变换可以知道 1/x = ny / (y - n),可以发现,y = n + 1时候,x 必然为整数,因此x = n  + n * n,y = n + 1,z = n。需要注意的是,当 n = 1时,x = 2,y = 2,不符合题意。

#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n;
	scanf("%d",&n);
	if (n == 1)	printf("-1\n");
	else	printf("%d %d %d\n",n*n + n,n + 1,n);
	return 0;
}

  

Codeforces Round #384 (Div. 2) C. Vladik and fractions(构造题)的更多相关文章

  1. Codeforces Round #384 (Div. 2) C. Vladik and fractions 构造题

    C. Vladik and fractions 题目链接 http://codeforces.com/contest/743/problem/C 题面 Vladik and Chloe decided ...

  2. Codeforces Round #384 (Div. 2) A. Vladik and flights 水题

    A. Vladik and flights 题目链接 http://codeforces.com/contest/743/problem/A 题面 Vladik is a competitive pr ...

  3. Codeforces Round #384 (Div. 2) E. Vladik and cards 状压dp

    E. Vladik and cards 题目链接 http://codeforces.com/contest/743/problem/E 题面 Vladik was bored on his way ...

  4. Codeforces Round #384 (Div. 2) 734E Vladik and cards

    E. Vladik and cards time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  5. Codeforces Round #275 (Div. 2) C - Diverse Permutation (构造)

    题目链接:Codeforces Round #275 (Div. 2) C - Diverse Permutation 题意:一串排列1~n.求一个序列当中相邻两项差的绝对值的个数(指绝对值不同的个数 ...

  6. Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题

    Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  ...

  7. Codeforces Round #298 (Div. 2) A、B、C题

    题目链接:Codeforces Round #298 (Div. 2) A. Exam An exam for n students will take place in a long and nar ...

  8. Codeforces Round #384 (Div. 2) //复习状压... 罚时爆炸 BOOM _DONE

    不想欠题了..... 多打打CF才知道自己智商不足啊... A. Vladik and flights 给你一个01串  相同之间随便飞 没有费用 不同的飞需要费用为  abs i-j 真是题意杀啊, ...

  9. Codeforces Round #384 (Div. 2)A,B,C,D

    A. Vladik and flights time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

随机推荐

  1. jquery双向列表选择器select版

    这个是select版的,若想美化某些样式是不支持得,可以用div模拟版的,功能基本实现能用了,需要其他功能自己加上. div模拟版链接:http://www.cnblogs.com/tie123abc ...

  2. ps如何裁剪掉图片的不规则区域

    按P,鼠标变成钢笔工具,点选住待清除区域,如下: 按ctrl+enter, 将点线变成选中区域: 按delete删除: ctrl+D取消选中区域 完成!

  3. Oracle数据行拆分多行

    工作和学习中常常会遇到一行要分割成多行数据的情况,在此整理一下做下对比. 单行拆分 如果表数据只有一行,则可以直接在原表上直接使用connect by+正则的方法,比如: select regexp_ ...

  4. Java实现上传下载

    一.上传 二.下载 import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.Fi ...

  5. jsmooth compilation failed error null

    JSmooth 0.9.9-7 在将 jar 文件打包成 exe 文件时报错:jsmooth compilation failed error null 原因,没有指定 logo 图片文件. http ...

  6. PHP中的数据库四、mongodb

    h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h ...

  7. Windows Server 2012 虚拟化实战:SCVMM的安装和部署

    本篇大概介绍一下在Windows Server 2012 R2上安装和部署SCVMM的过程及其注意事项.下图是我们数据中心SCVMM的基本架构,其中 SCVMM Database 是用于存储了所有配置 ...

  8. 记一次简单的SQL优化

    原来的sql是这样写的 SELECT d.ONSALE_BARCODE, d.ONSALE_NAME, c.ONSALE_ID, CAST( , ) ) AS CUSTOMARY_PRICE, CAS ...

  9. Linux下的C Socket编程 -- server端的简单示例

    Linux下的C Socket编程(三) server端的简单示例 经过前面的client端的学习,我们已经知道了如何创建socket,所以接下来就是去绑定他到具体的一个端口上面去. 绑定socket ...

  10. codevs 1080 线段树点修改

    先来介绍一下线段树. 线段树是一个把线段,或者说一个区间储存在二叉树中.如图所示的就是一棵线段树,它维护一个区间的和. 蓝色数字的是线段树的节点在数组中的位置,它表示的区间已经在图上标出,它的值就是这 ...