CF1166C A Tale of Two Lands】的更多相关文章

思路: 搞了半天发现和绝对值无关. http://codeforces.com/blog/entry/67081 实现: #include <bits/stdc++.h> using namespace std; typedef long long ll; ]; int main() { int n; while (cin >> n) { ll ans = ; ; i < n; i++) { cin >> a[i]; a[i] = abs(a[i]); } sor…
比赛的时候lowerbound用错了 现场WA on test4(好吧我承认我那份代码确实有除了lowerbound以外的问题) 于是只能手动二分 (我好菜啊QAQ 经过一波数学推算,我们发现,设序列为\(a\),对于\(a_i\)它不管是正的还是负的答案都是一样的,所以上来我们就珂以给这个数列ABS一下,然后我们拿到了一个正数数列,那么应该怎么求呢? 设有两个序列中的数\(a_x\),\(a_y\).且我们定义\(a_y<a_x\).我们发现Arrayland的领土边界为\([a_y,a_x]…
A Tale of Two Lands 题目链接(点击) The legend of the foundation of Vectorland talks of two integers xx and yy. Centuries ago, the array king placed two markers at points |x||x| and |y||y| on the number line and conquered all the land in between (including…
链接:https://codeforces.com/contest/1166/problem/C 题意: The legend of the foundation of Vectorland talks of two integers xx and yy. Centuries ago, the array king placed two markers at points |x||x| and |y||y| on the number line and conquered all the lan…
原题链接 参考代码: #include <cstdio> #define mid ((l + r) / 2) #include <algorithm> using namespace std; + , maxvalue = 1e9; int n, value[maxn]; int main() { scanf("%d", &n); ; i < n; i ++) { scanf("%d", &value[i]); ) va…
题目链接:http://codeforces.com/problemset/problem/1166/C 题目大意 给定 n 个数,任选其中两个数 x,y,使得区间 [min(|x - y|, |x + y|), max(|x - y|, |x + y|)] 能完全盖过区间 [min(|x|, |y|), max(|x|, |y|)],请问一共有多少种选法? 分析 先随便举个例子,比如 |x| = 3, |y| = 5,可以发现,不管是 [3, 5],还是 [-3, 5], [3, -5], […
C. A Tale of Two Lands 题意: 给出 n 个数,问有多少点对(x,y)满足 |x-y| ≤ |x|,|y| ≤ |x+y|: (x,y) 和 (y,x) 表示一种答案: 题解: 数形结合: 对于某数 x 查找满足条件 y 有多少个: ①x ≥ 0 y ∈ [x/2 , 2x] ∪ [ -2x , -x/2]; ②x < 0 y ∈ [2x , -x/2] ∪ [-x/2 , -2x]; 特别注意临界值 x/2 处: AC代码: #include<bits/stdc++.h…
1343. Fairy Tale Time limit: 1.0 secondMemory limit: 64 MB 12 months to sing and dance in a ring their celestial dance. One after another they hold a throne. The first is young and fierce January and the last is elderly and wise December. Leaving the…
Tale Tale的英文含义为故事,我相信每个坚持写Blog的人都是有故事的:中文你叫它 塌了 也无所谓 . Tale 使用了轻量级mvc框架 Blade 开发,默认主题使用了漂亮的 pinghsu,如果觉得这个项目不错,请为它点赞支持. 演示站点:https://tale.biezhi.me 开始使用  |  参与贡献  |  捐赠  |  English 特性 设计简洁,界面美观 Markdown文章发布 自定义文章链接 支持多主题 支持Emoji表情 支持网易云音乐播放 支持附件和数据库备…
除了闷头专研技术之外,程序员还需要不断地写作进行技术积累,写博客是其中最重要的方式之一.商业博客平台不少,但是更符合程序员背景的方案,是自己开发一个博客平台或者使用开源的博客平台. 开源的博客平台多如牛毛,而且不乏优秀之作,如 Hexo.Octopress.Jekyll.Wordpress.本系列文章将分享如何利用各种博客引擎在云端搭建属于自己的个人博客.今天这一篇,介绍如何在快速部署一个国人用 Java 开发的博客系统. 前几天,在社区看到有国人开发者开源了用 Java 写的一个博客系统 Ta…