vjudge I - Vladik and fractions 一道小学生的提。
原题链接:https://vjudge.net/contest/331993#problem/I
Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction as a sum of three distinct positive fractions in form
.
Help Vladik with that, i.e for a given n find three distinct positive integers x, y and z such that . Because Chloe can't check Vladik's answer if the numbers are large, he asks you to print numbers not exceeding 109.
If there is no such answer, print -1.
Input
The single line contains single integer n (1 ≤ n ≤ 104).
Output
If the answer exists, print 3 distinct numbers x, y and z (1 ≤ x, y, z ≤ 109, x ≠ y, x ≠ z, y ≠ z). Otherwise print -1.
If there are multiple answers, print any of them.
Examples
3
2 7 42
7
7 8 56 简单来说,就是对于给定的n,构建一组x,y,z,使得1/x + 1/y +1/z =2/ n 然后 当n=1的时候 输出-1
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
if(n==) cout<<"-1"<<endl;
else cout<<n<<endl<<n+<<endl<<n*(n+);
return ;
}
其实, 可以看作,

vjudge I - Vladik and fractions 一道小学生的提。的更多相关文章
- Codeforces Round #384 (Div. 2) C. Vladik and fractions 构造题
C. Vladik and fractions 题目链接 http://codeforces.com/contest/743/problem/C 题面 Vladik and Chloe decided ...
- Codeforces 743C - Vladik and fractions (构造)
Codeforces Round #384 (Div. 2) 题目链接:Vladik and fractions Vladik and Chloe decided to determine who o ...
- 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 ...
- 【44.64%】【codeforces 743C】Vladik and fractions
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- CodeForces 743C Vladik and fractions (数论)
题意:给定n,求三个不同的数满足,2/n = 1/x + 1/y + 1/z. 析:首先1是没有解的,然后其他解都可以这样来表示 1/n, 1/(n+1), 1/(n*(n+1)),这三个解. 代码如 ...
- 数学【CF743C】Vladik and fractions
Description 请找出一组合法的解使得\(\frac {1}{x} + \frac{1}{y} + \frac {1}{z} = \frac {2}{n}\)成立 其中\(x,y,z\)为正整 ...
- CF C. Vladik and fractions——构造题
题目 构造一组 $x, y, z$,使得对于给定的 $n$,满足 $\frac{1}{x} + \frac{1}{y} + \frac{1}{z} = \frac{2}{n}$. 分析: 样例二已 ...
- [codeforces743C]:Vladik and fractions(数学)
题目传送门 题目描述 请找出一组合法解使得$\frac{1}{x}+\frac{1}{y}+\frac{1}{z}=\frac{2}{n}$成立. 其中$x,y,z$为正整数且互不相同. 输入格式 一 ...
- CF2.C
C. Vladik and fractions time limit per test 1 second memory limit per test 256 megabytes input stand ...
随机推荐
- 利用预测分析改进欠款催收策略,控制欺诈风险和信贷风险—— Altair Knowledge Studio 预测分析和机器学习
前提摘要 在数字经济新时代,金融服务主管正在寻求方法去细分他们的产品和市场,保持与客户的联系,寻找能够推动增长和收入的新市场,并利用可以增加优势和降低风险的新技术. 在拥有了众多可用数据之后,金融机构 ...
- 源码浅析:MySQL一条insert操作,会写哪些文件?包括UNDO相关的文件吗?
DML操作的大致流程 在解答上述疑惑之前,我们来梳理一下DML操作的大致流程: 1.语法解析.语义解析 2.生成执行计划 3.事务修改阶段 1) 激活事务,事务状态由not_active变为activ ...
- 2019-2020-2 20175121杨波《网络对抗技术》第一周kali的安装
2019-2020-2 20175121杨波<网络对抗技术>第一周kali的安装 标签 : Linux 一.下载安装kali 1.下载kali 下载链接 打开链接进入官网后,点击Torre ...
- 《HTML&CSS design and build websites》学习笔记(1)
Chapter 1: Structure Chapter 2: Text <head>表示标题,默认显示在第一行. <title>表示抬头,显示在浏览器的标签页,还有窗口栏. ...
- tomcat下载页面多个版本区别
- LeetCode 面试题 02.03. 删除中间节点
题目链接:https://leetcode-cn.com/problems/delete-middle-node-lcci/ 实现一种算法,删除单向链表中间的某个节点(除了第一个和最后一个节点,不一定 ...
- 数据结构(集合)学习之List
集合 框架关系图: Collection接口下面有三个子接口:List.Set.Queue.此篇是关于List<E>的简单学习总结. 补充:HashTable父类是Dictionary,不 ...
- 将小账本上传到GitHub
在假期的时候我已经注册好了用户 https://www.cnblogs.com/1234yyf/p/12312072.html 然后我将我的小账本上传到GitHub上面:一步一步跟着就可以上传成功!! ...
- redis的一些常见面试题
1 .在项目中缓存是如何使用的? 2.为啥在项目里要用缓存呢? 用缓存,主要用途,高性能和高并发 高性能: 场景举例:假如有这么一个操作,用户发起请求,操作数据库,查出结果,耗时600ms,然后这个结 ...
- 论文阅读笔记(十七)【ICCV2017】:Dynamic Label Graph Matching for Unsupervised Video Re-Identification
Introduction 文章主要提出了 Dynamic Graph Matching(DGM)方法,以非监督的方式对多个相机的行人视频中识别出正确匹配.错误匹配的结果.本文主要思想如下图: 具体而言 ...