题目大意

给出 \(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. Dev-Cpp下载与安装

    目录 一.介绍 Dev-Cpp 二.下载 Dev-Cpp 1.通过百度网盘下载 2.通过 SourceForge 官网下载 三.安装 Dev-Cpp 写在结尾的话 免责声明 大家好,这里是 main工 ...

  2. .NET性能优化-ArrayPool同时复用数组和对象

    前两天在微信后台收到了读者的私信,问了一个这样的问题,由于私信回复有字数和篇幅限制,我在这里统一回复一下.读者的问题是这样的: 大佬您好,之前读了您的文章受益匪浅,我们有一个项目经常占用 7-8GB ...

  3. hdoj笔记1000

    1000,A+B problem #include <stdio.h>//要用EOF!! int main() { int a,b; while(scanf("%d%d" ...

  4. java中加号的用法

    注意java中+号的使用 public class Add { public static void main(String[] args) { System.out.println(100+80); ...

  5. Netty-BIO、NIO、AIO、零拷贝-2

    Java BIO 编程 一.I/O 模型 1.I/O 模型简单的理解:就是用什么样的通道进行数据的发送和接收,很大程度上决定了程序通信的性能 2.Java 共支持 3 种网络编程模型/IO 模式:BI ...

  6. 用了这么多年的 SpringBoot 你知道什么是 SpringBoot 的 Web 类型推断吗?

    用了这么多年的 SpringBoot 那么你知道什么是 SpringBoot 的 web 类型推断吗? 估计很多小伙伴都不知道,毕竟平时开发做项目的时候做的都是普通的 web 项目并不需要什么特别的了 ...

  7. 前端工程化筑基-Node/npm/babel/polyfill/webpack

    00.前端搬砖框架 开发 ⇨ 构建 ⇨ 部署上线 ⇨ 摸鱼: 01.Node.js/npm Node.JS 是一个基于 Chrome V8 引擎 的 JavaScript 运行时环境,不是JS库(是C ...

  8. 数值计算:前向和反向自动微分(Python实现)

    1 自动微分 我们在<数值分析>课程中已经学过许多经典的数值微分方法.许多经典的数值微分算法非常快,因为它们只需要计算差商.然而,他们的主要缺点在于他们是数值的,这意味着有限的算术精度和不 ...

  9. [常用工具] Python视频处理库VidGear使用指北

    VidGear是一个高性能的Python视频处理库,它在预载多个专业视频图像处理库的基础上,如OpenCV.FFmpeg.ZeroMQ.picamera.starlette.yt_dlp.pyscre ...

  10. C#应用程序配置文件(XML序列化) - 开源研究系列文章

    上次写了一个C#线程池及管理器的博文( C#开发的线程池和管理器 - 开源研究系列文章 ),收到了不小的浏览量,在此感谢各位网友的支持.这次将另一个功能放出来单独讲解:C#应用程序的配置文件,使用的是 ...