CF C. Vladik and fractions——构造题
题目
构造一组 $x, y, z$,使得对于给定的 $n$,满足 $\frac{1}{x} + \frac{1}{y} + \frac{1}{z} = \frac{2}{n}$.
分析:
样例二已经暴露了此题的本质。
显然 $n, (n+1), n(n+1)$ 为一组合法解。特殊地,当 $n=1$ 时,无解,因为此时 $n+1$ 与 $n(n+1)$ 相等(也可以证明没有其他形式的解)。
#include<bits/stdc++.h>
using namespace std; int n; int main()
{
scanf("%d", &n);
if(n == ) printf("-1\n");
else printf("%d %d %d\n", n, n+, n*(n+));
return ;
}
参考链接:https://oi-wiki.org/basic/construction/
CF C. 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 ...
- CF1110E Magic Stones(构造题)
这场CF怎么这么多构造题…… 题目链接:CF原网 洛谷 题目大意:给定两个长度为 $n$ 的序列 $c$ 和 $t$.每次我们可以对 $c_i(2\le i<n)$ 进行一次操作,也就是把 $c ...
- cf251.2.C (构造题的技巧)
C. Devu and Partitioning of the Array time limit per test 1 second memory limit per test 256 megabyt ...
- hdu4671 Backup Plan ——构造题
link:http://acm.hdu.edu.cn/showproblem.php?pid=4671 其实是不难的那种构造题,先排第一列,第二列从后往前选. #include <iostrea ...
- Educational Codeforces Round 7 D. Optimal Number Permutation 构造题
D. Optimal Number Permutation 题目连接: http://www.codeforces.com/contest/622/problem/D Description You ...
- Codeforces 482 - Diverse Permutation 构造题
这是一道蛮基础的构造题. - k +(k - 1) -(k - 2) 1 + k , 1 , k , 2, ....... ...
- BZOJ 3097: Hash Killer I【构造题,思维题】
3097: Hash Killer I Time Limit: 5 Sec Memory Limit: 128 MBSec Special JudgeSubmit: 963 Solved: 36 ...
- CDOJ 1288 旅游的Final柱 构造题
旅游的Final柱 题目连接: http://acm.uestc.edu.cn/#/problem/show/1288 Description 柱神要去打Final啦~(≧▽≦)/~啦啦啦 柱神来到了 ...
随机推荐
- LeetCode 637. 二叉树的层平均值(Average of Levels in Binary Tree)
637. 二叉树的层平均值 637. Average of Levels in Binary Tree LeetCode637. Average of Levels in Binary Tree 题目 ...
- [转帖]两种以太网 RDMA 协议: iWARP 和 RoCE
两种以太网 RDMA 协议: iWARP 和 RoCE https://weibo.com/p/1001603936363903889917?mod=zwenzhang 写的挺好的呢. 本文是讲演 H ...
- How to change default root@ email address linux / postfix / centos?
Change root@hostname to different email address By default, any email sent by system is sent to root ...
- Hystrix【入门】
公共依赖配置: <parent> <groupId>org.springframework.boot</groupId> <artifactId>spr ...
- (零)linux 学习 -- 从 shell 开始
The Linux Command Line 读书笔记 - 部分内容来自 http://billie66.github.io/TLCL/book/chap02.html 文章目录 前言 什么是 she ...
- hdu 6609 区间条件前缀和 + 二分
题目传送门//res tp hdu 目的 在尾部逐步插入n个元素,求插入第i个元素时,[1,i)内删去多少个元素,可使前缀和[1,i]不大于m 多测Q [1,15] n [1,2e5] m [1,1e ...
- ~postman全局变量与环境变量介绍
postman官方文档:https://learning.getpostman.com/docs/postman/scripts/test_examples/ 一.环境变量 实例:将URL作为环境变量 ...
- (转) 嵌入式 Linux 利用 udev 实现自动检测挂载U盘
本文链接:https://blog.csdn.net/cfl927096306/article/details/95180940 udev配置文件是/etc/udev/udev.conf,也许长这样: ...
- C# 字符串按设置的格试在前面或后面增加空格或其它字符
public string lengadd(string stringa, string stringb, int count, int mode) //以stringa的长度,未到count的长度则 ...
- 微信小程序自定义组件——接受外部传入的样式类
https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html 外部样式类 有时, ...