题目大意

给出 \(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. easui 两个combobox相互选中时至对方为空的解决方案

    combobox HTML: <select id="monthplan" class="zxui-combobox" name="monthp ...

  2. jsp 页面返回、本页面刷新

    返回上一页面: window.history.go(-1);  //返回上一页window.history.back();  //返回上一页 返回上一页面并对上一页面刷新: history.go(-1 ...

  3. Mybatis04:延迟加载、一二级缓存、注解开发

    今日内容 mybatis中的延迟加载 延迟加载的概念 立即加载的概念 如果实现延迟加载 Mybatis中的缓存 什么是缓存 为什么使用缓存 什么数据可以使用缓存,什么样的数据不能使用缓存 Mybati ...

  4. 数据科学家赚多少?基于pandasql和plotly的薪资分析与可视化 ⛵

    作者:韩信子@ShowMeAI 数据分析实战系列:https://www.showmeai.tech/tutorials/40 AI 岗位&攻略系列:https://www.showmeai. ...

  5. js 定时器(setInterval)

    js 定时器 分类 编程技术 js 定时器有以下两个方法: setInterval() :按照指定的周期(以毫秒计)来调用函数或计算表达式.方法会不停地调用函数,直到 clearInterval() ...

  6. java中的动态绑定机制

    本文主要讲述java中的动态绑定机制. 老韩ppt关于动态绑定机制: 示例代码如下: public class DynamicBinding { public static void main(Str ...

  7. DNS欺骗

    原理: dns欺骗又可以叫作中间人人攻击,主要是通过拦截受害人在访问某个网站时设备向外发送的dns请求,然后给出伪造的dns应答,实现欺骗过程. 实验脚本如下: from scapy.layers.d ...

  8. SQLSERVER 居然也能调 C# 代码 ?

    一:背景 1. 讲故事 前些天看到一个奇怪的 Function 函数,调用的是 C# 链接库中的一个 UserLogin 方法,参考代码如下: CREATE FUNCTION dbo.clr_User ...

  9. 一文详解RocketMQ的存储模型

    摘要:RocketMQ 优异的性能表现,必然绕不开其优秀的存储模型. 本文分享自华为云社区<终于弄明白了 RocketMQ 的存储模型>,作者:勇哥java实战分享. RocketMQ 优 ...

  10. vue-element-admin 安装(node方式)

    vue-element-admin node方式安装 需要的环境: git .node.js 1.git clone 项目(2选 1) // github https://github.com/Pan ...