题目大意

给出 \(n\),求一组 \(x,y,z\) 满足 \(\frac 1x + \frac 1y + \frac 1z = \frac 2n\)

若不存在合法的解,输出 \(-1\)

其中 \(n \le 10^4\)

要求答案中的 \(x,y,z \le 2*10^9\)

思路

让人无语的小学数学题······

都学过裂项吧!我们一起来构造!!

\(\frac 1{x\times(x+1)} = \frac 1x - \frac 1{x+1}\)

把右边的 \(\frac 1{x+1}\) 移到左边

然后你把 \(x\) 看作 \(n\)

然后左边补个 \(\frac 1n\) 凑到 \(\frac 2n\)

然后就成了 \(\frac 1n = \frac 1n + \frac 1{n+1} + \frac 1{n\times(n+1)}\)

然后 \(x,y,z\) 就显然了

然后······

就没有然后了······

代码

#include<cstdio>
using namespace std; int n; int main()
{
scanf("%d" , &n);
if (n == 1)
{
printf("-1");
return 0;
}
printf("%d %d %d" , n , n + 1 , n * (n + 1));
}

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 743C - Vladik and fractions (构造)

    Codeforces Round #384 (Div. 2) 题目链接:Vladik and fractions Vladik and Chloe decided to determine who o ...

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

  4. 【44.64%】【codeforces 743C】Vladik and fractions

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  5. vjudge I - Vladik and fractions 一道小学生的提。

    原题链接:https://vjudge.net/contest/331993#problem/I Vladik and Chloe decided to determine who of them i ...

  6. CodeForces 743C Vladik and fractions (数论)

    题意:给定n,求三个不同的数满足,2/n = 1/x + 1/y + 1/z. 析:首先1是没有解的,然后其他解都可以这样来表示 1/n, 1/(n+1), 1/(n*(n+1)),这三个解. 代码如 ...

  7. 数学【CF743C】Vladik and fractions

    Description 请找出一组合法的解使得\(\frac {1}{x} + \frac{1}{y} + \frac {1}{z} = \frac {2}{n}\)成立 其中\(x,y,z\)为正整 ...

  8. CF C. Vladik and fractions——构造题

    题目 构造一组 $x, y, z$,使得对于给定的 $n$,满足 $\frac{1}{x}  + \frac{1}{y} + \frac{1}{z} =  \frac{2}{n}$. 分析: 样例二已 ...

  9. [codeforces743C]:Vladik and fractions(数学)

    题目传送门 题目描述 请找出一组合法解使得$\frac{1}{x}+\frac{1}{y}+\frac{1}{z}=\frac{2}{n}$成立. 其中$x,y,z$为正整数且互不相同. 输入格式 一 ...

  10. CF2.C

    C. Vladik and fractions time limit per test 1 second memory limit per test 256 megabytes input stand ...

随机推荐

  1. 大数据HDFS凭啥能存下百亿数据?

    欢迎关注大数据系列课程 前言 大家平时经常用的百度网盘存放电影.照片.文档等,那有想过百度网盘是如何存下那么多文件的呢?难到是用一台计算机器存的吗?那得多大磁盘啊?显然不是的,那本文就带大家揭秘. 分 ...

  2. 文件压缩和vi编辑器

    一.压缩,解压缩 1.gzip 和 bzip2 gzip和bzip都是压缩软件,比如windows里的好压和360 压缩或微软自带的等等 命令格式是:gzip或者bzip  + 0-9的压缩等级(数字 ...

  3. 关于Window中右键新建菜单的设置

    在日常工作中,有时候需要根据自己的需要对Windows桌面右键新建菜单进行自定义,自定义的方法如下: 1.在Window中输入Win+R调出运行命令框 2.输入regedit,打开注册表 3.如果想要 ...

  4. python 错误之TypeError: XXXXX() takes no keyword arguments

    举个例子: str1 = 'sunlightn' f = str1.rfind("n", __start=1, __end=2) print(f) 以上代码运行后出现: " ...

  5. 发送http2请求

    有时服务器会检测http协议版本,有http/1.1和h2,requests发送的是http1.1的请求 # pip install httpx client = httpx.Client(http2 ...

  6. java中String类型的相关知识的简单总结

    java中String类型的相关知识总结 一.常用方法: 1.构造方法: byte数组 可指定offset和length 可指定charset char数组 可指定offset和count 字符序列 ...

  7. win32com操作word 第二集:Application&Documents接口

    本课程<win32com操作word API精讲&项目实战>以视频为主,文字教程为辅,公众号ID:一灯编程. 先回答一个网友私信问题: win32com和微软的word接口文档有什 ...

  8. Blazor如何实现类似于微信的Tab切换?

    是否有小伙伴在使用tab的时候想进行滑动切换Tab? 并且有滑动左出左进,右出右进的效果 ,本文将讲解怎么在Blazor中去通过滑动切换Tab 本文中的UI组件使用的是MASA Blazor,您也可以 ...

  9. while循環的一些判斷條件和讀取循環精簡方法

    while是入口條件循環 在進入循環體時必須要有獲取輸入數據并判斷的并檢查輸入數據的值,所以在while之前放一個scanf函數,讓循環繼續執行. 如果想讓循環繼續進行,那麽還需要在循環内設置一個讀取 ...

  10. Loj 507 接竹竿 题解

    Loj链接:接竹竿 $ {\scr \color {SkyBlue}{\text{Solution}}} $ 题目大意: 给定一个数组,每次加入一种颜色的数,可以取走与它颜色相同的两个数之间的所有数, ...