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啦~(≧▽≦)/~啦啦啦 柱神来到了 ...
随机推荐
- start use webpack
Demo0操作手册 本Demo演示不使用配置文件的入门级使用 准备环境 初始化环境, cd到demo目录之后, 执行如下命令: npm init -y npm install webpack webp ...
- PHP,Excel导出换行
// 有id,才算真的有发票数据 if ($v['b_invoice_id']) { $v['b_invoice_info'] = json_decode($v['b_invoice_json'],t ...
- 彻底关闭networkmanager
chkconfig NetworkManager offsystemctl stop NetworkManagersystemctl disable NetworkManager
- JS实现可用滑块滑动的缓动图
尝试模仿京东的"发现好货"模块的可用滑块滑动的缓动图 JS代码 function $(id) { return document.getElementById(id); } //缓 ...
- Golang常用快捷键以及常见快捷键冲突
配置快捷键: 跳转到函数定义 回退 查找函数使用 File/Settings/Keymap 工具: gofmt/golint File/Settings/Tools/File Watchers gol ...
- CH09 开机自动烧录QSPI
版本信息: 版本 REV2018 时间 05/22/2018 XILINX ZYNQ LINUX篇 基于米联MZ7X系列 电子版自学资料 常 ...
- Liar CodeForces - 822E (dp,后缀数组)
大意: 给定串$s,t$, 给定整数$x$, 求判断$t$是否能划分为至多$x$段, 使这些段在$s$中按顺序,不交叉的出现. 设$dp_{i,j}$表示$s$匹配到$i$位, 划分了$j$段, 匹配 ...
- PAT-1107 Social Clusters (30 分) 并查集模板
1107 Social Clusters (30 分) When register on a social network, you are always asked to specify your ...
- 在论坛中出现的比较难的sql问题:15(生成动态删除列语句 分组内多行转为多列)
原文:在论坛中出现的比较难的sql问题:15(生成动态删除列语句 分组内多行转为多列) 所以,觉得有必要记录下来,这样以后再次碰到这类问题,也能从中获取解答的思路. 1.如果去掉这个临时表中合计为0 ...
- SQL SERVER 中如何获取日期(一个月的最后一日、一年的第一日等等)
https://blog.csdn.net/deepwishly/article/details/9101307 这是计算一个月第一天的SQL 脚本: SELECT DATEADD(mm, DAT ...