C. Vladik and fractions

题目链接

http://codeforces.com/contest/743/problem/C

题面

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 x, y 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.

输入

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

输出

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

If there are multiple answers, print any of them.

样例输入

3

样例输出

2 7 42

题意

给你n,让你找到一个x,y,z,使得2/n = 1/x+1/y+1/z

题解

n=1的时候无解,否则可以构造出x=n,y=n+1,z=n(n+1)

代码

#include<bits/stdc++.h>
using namespace std; long long n;
int main()
{
cin>>n;
if(n==1)cout<<"-1"<<endl;
else cout<<n<<" "<<n+1<<" "<<n*(n+1)<<endl;
}

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

  1. 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 ...

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

    传送门 Description Vladik and Chloe decided to determine who of them is better at math. Vladik claimed ...

  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. 开不了的窗_____window.open

    window.open()是原来常用的新开窗口的方式,但是呢,现在会被大多数浏览器阻止掉,默认为是非用户意愿的打开窗口,即广告之类的. 但是通过a链接的事件来open是可以的,因为这样会认为是用户主观 ...

  2. 查看mssql的锁

    USE [master]GO /****** Object: StoredProcedure [dbo].[sp_who_lock] Script Date: 10/02/2014 06:18:19 ...

  3. PHP部分字符串函数汇总

    PHP部分字符串函数汇总 提交 我的评论 加载中 已评论 PHP部分字符串函数汇总 2015-03-10 PHP100中文网 PHP100中文网 PHP100中文网 微信号 功能介绍 互联网开发者社区 ...

  4. 第12周&第13周

    12&13:STL Standard Template Library sort, binary_search/lower_bound/upper_bound, multiset, set, ...

  5. golang 值得注意的地方(2则)

    golang 的语法和使用方式都非常简单明了,没有花哨的语法糖,也没有多余的关键字. 但是即使是这么简洁的语言,仍然有一些不那么直白,需要注意的地方,比如下面2点. interface 赋值 nil ...

  6. 个性二维码开源专题<液化/圆角/效果>

    基础方法: ChangeFillShape //修改填充形状 ChangeFillShape(...) // 摘要: // 修改填充形状 // // 参数: // g: // 图形画板 // // F ...

  7. oracle ORA-00911 问题 解决

    书写sql语句 using (OracleConnection conn = new OracleConnection(OracleString)) { conn.Open(); var trans ...

  8. Visual Studio 2013 新功能 Memory Dump 分析器

    本文为 Dennis Gao 原创技术文章,发表于博客园博客,未经作者本人允许禁止任何形式的转载. TechEd2013 发现新功能 12月5日和6日,在国家会议中心参加了微软的 TechEd2013 ...

  9. 微软BI 之SSIS 系列 - 使用 Script Component Destination 和 ADO.NET 解析不规则文件并插入数据

    开篇介绍 这一篇文章是 微软BI 之SSIS 系列 - 带有 Header 和 Trailer 的不规则的平面文件输出处理技巧 的续篇,在上篇文章中介绍到了对于这种不规则文件输出的处理方式.比如下图中 ...

  10. 使用SharePoint CSOM 编写高效的程序

    上一篇文章中简单的介绍了使用CSOM进行编程.今天主要讲一下CSOM使用中一些小技巧,可以让你的程序运行的更快. 单独加载某些属性 在上文中的例子,需要返回Web对象信息的时候,我们使用了如下的代码: ...