题目大意

给出 \(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. 关于CSDN获取博客内容接口的x-ca-signature签名算法研究

    前言 源码下载 不知道怎么就不通过了,这篇文章放出去几个月了,然后突然告诉我不行了,所以我打算换个平台(至少不能在一棵树吊死),垃圾审核 我最初想直接获取html博客,然后保存在本地,最后发布到别的博 ...

  2. Go 的windows安装与环境配置

    1.请前往go的官网下载安装包:https://golang.org/dl/ 安装你如果C盘够大比较土豪就一路next即可,在这里小编穷就安装到了D:\Program Files\Go 2.环境变量配 ...

  3. js- day03- 将数据变成柱形图

    柱形图的渲染 * {             margin: 0;             padding: 0;         }  .box {             display: fle ...

  4. 【Shell案例】【awk匹配、grep查找文件内的字符串】6、去掉空行(删除空行)

    描述写一个 bash脚本以去掉一个文本文件 nowcoder.txt中的空行示例:假设 nowcoder.txt 内容如下:abc 567 aaabbb ccc 你的脚本应当输出:abc567aaab ...

  5. 用openpyxl创建工作簿和工作表

    import osimport openpyxl #设置默认路径os.chdir(r'D:/openpyxl/') #创建工作簿变量 wb = openpyxl.Workbook() #创建工作表变量 ...

  6. VmWare安装Centos后配置Net网络SSH链接问题看这一遍就够了

    1:首先安装VmWare 2:启动时在安装对应的Linux版本,网络就默认 net即可 3:都安装好了之后,注意有一个大坑,输入的账号密码都不能准确登录 最后发现是linux默认的输入法没有启用电脑键 ...

  7. Django简介以及基本使用

    目录 Django简介以及基本使用 一.django简介 1.web框架的本质是什么 ? 2.python主流web框架有那些 ? 3.web框架的推导过程 二.基本使用 1.运行django注意事项 ...

  8. TiDB上百T数据拆分实践

    背景 提高TiDB可用性,需要把多点已有上百T TiDB集群拆分出2套 挑战 1.现有需要拆分的12套TiDB集群的版本多(4.0.9.5.1.1.5.1.2都有),每个版本拆分方法存在不一样 2.其 ...

  9. C/S UDP通信实践踩坑记录与对于ICMP的进一步认识

    背景 最近有个业务场景需要服务端(简称S)与客户端(简称C)设计一套基于UDP的通信协议--要求尽可能快的前提下可容忍一定丢包率,得以比较深入地学习和了解UDP通信和实践,在开发调试期间先后碰到了C端 ...

  10. 传播问卷调查数据不够?自己生成假数据!Python编程一对一教学

    问卷调查 Excel 样式 原文件下载 生成代码 序号 直接 range 生成即可. 提交答卷时间 import time time_str = time.strftime('%Y/%m/%d %H: ...