题目大意

给出 \(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. ArcObjects SDK开发 001 ArcObjects SDK 简介

    1.什么是ArcObjects SDK 在网上搜索什么是ArcObjects,会搜到如下的定义. 这个定义比较准确,也比较容易理解. 2.什么是ArcEngine 在网上搜索ArcEngine,一般会 ...

  2. Java常用开发文档及工具

    一.实用工具/网站 1.PHP中文网:https://www.php.cn/ 2.Json工具:http://www.bejson.com/ 3.IT大哥导航:https://itdage.com/ ...

  3. 【SQL进阶】【表默认值、自增、修改表列名、列顺序】Day02:表与索引操作

    一.表的创建.修改与删除 1.创建一张新表 [设置日期默认值.设置id自增] [注意有备注添加备注COMMENT] CREATE TABLE user_info_vip( id int(11) pri ...

  4. intel Pin:动态二进制插桩的安装和使用,以及如何开发一个自己的Pintool

    先贴几个你可能用得上的链接 intel Pin的官方介绍Pin: Pin 3.21 User Guide (intel.com) intel Pin的API文档Pin: API Reference ( ...

  5. 如何通过C#合并Word文档?

    合并Word文档可以快速地将多份编辑好的文档合在一起,避免复制粘贴时遗漏内容,以及耗费不必要的时间,同时,也方便了人们阅读或者对其进行再次修改.例如,在我们进行团队作业的时候,每个人都会有不同的分工, ...

  6. 持续发烧,聊聊Dart语言的静态编译,能挑战Go不?

    前言 前两天写了几篇文章,谈了谈Dart做后端开发的优势,比如: <Dart开发服务端,我是不是发烧(骚)了?> <持续发烧,试试Dart语言的异步操作,效率提升500%> & ...

  7. 如何使用Abstract类?抽象类的威力

    简介: 今天我想谈谈如何使用抽象类,以及抽象类真正的威力.本文将结合具体业务来说明如何使用抽象类. 业务简述: 本人目前只接触过PMS(物业管理系统),公司主要业务的是美国的租房业务.由于美国租房和中 ...

  8. vue移动端封装底部导航

    <template> <div class="myfooter flex-betweenCenter"> <router-link tag=" ...

  9. 何为GUI???

    1.GUI是什么–简介 GUI的全称为Graphical User Interface,图形化界面或图形用户接口,是指采用图形方式显示的计算机操作环境用户接口.与早期计算机使用的命令行界面相比,图形界 ...

  10. 如何使用 Blackbox Exporter 监控 URL?

    前言 监控域名和 URL 是可观察性的一个重要方面,主要用于诊断可用性问题.接下来会详细介绍如何使用 Blackbox Exporter 和 Prometheus 在 Kubernetes 中实现 U ...