codeforces 392A Blocked Points】的更多相关文章

我的方式是用暴力的方法找到每一行每一列的边界点: 但是有大神直接用一个公式解决了:floor(n*sqrt(2))*4: 想了很久还是不理解,求各路大神指点! #include<iostream> #include<cmath> #include<cstring> using namespace std; int main() { long long n; cin>>n; ){cout<<;;} ,cur; ; ;i<=n;i++) { c…
题目链接 题意 : 给你一个半径为n的圆,圆里边还有圆上都有很多整点,让你找出与圆外的任意一个整点距离等于1的点. 思路 :这个题可以用枚举,画个图就发现了,比如说先数第一象限的,往下往右找,还可以找规律,看到神代码就4行,我十分佩服数学学的特别好的人.... 大神博客地址 下边这个是枚举的代码,也很简单. #include<stdio.h> #include<iostream> #include<algorithm> using namespace std; #def…
D. Points Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/19/problem/D Description Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (…
link:http://codeforces.com/contest/347/problem/B 很简单,最多只能交换一次,也就是说,最多会增加两个.可能会增加一个.也可能一个也不增加(此时都是fixed point) #include <cstdio> using namespace std; ]; int main(void) { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); #endif i…
题目链接: E. Points on Plane time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On a plane are n points (xi, yi) with integer coordinates between 0 and 106. The distance between the two points wi…
题目链接:http://codeforces.com/problemset/problem/347/B 题目意思:给出一个包含n个数的排列a,在排列a中最多只能作一次交换,使得ai = i 这样的匹配达到最多. 作一次交换,最理想的情况是,在原来匹配好的序列中再匹配到两个数:最坏的情况是,即使作怎样的交换,都不可能再找到可以匹配的两个数,也就是说,根本不需要作交换.至于一般情况下,是可以再匹配到一个数的. 我是设了两个数组(分别有n个数):a(用来存储待判断的序列a)和b(依次存储0-n-1个数…
题目链接:http://codeforces.com/contest/19/problem/D 题意:给出3种操作:1)添加点(x,y),2)删除点(x,y),3)查询离(x,y)最近的右上方的点. 且满足添加的点不重复,删除的点一定存在. 题解:只要以x建树,记录下每个结点最大的y值.每次都更新一下.用线段树查找满足条件的最小的x,然后用一个set[x]来存x点下的y点. 然后用二分查找满足条件的最小的y. #include <iostream> #include <cstring&g…
题目描述: Match Points time limit per test 2 seconds memory limit per test 256 mega bytes input standard input output standard output You are given a set of points x1, , ..., *x**n* Two points iand jcan be matched with each other if the following conditi…
题 OvO http://codeforces.com/contest/871/problem/C ( Codeforces Round #440 (Div. 1, based on Technocup 2018 Elimination Round 2) - C ) 解 问题可以转化为:这些点可以产生的横线与竖线的出现情况 首先,对于二维坐标系中的每一行中,对于每个点,如果右边有点,则从该点向右边这个点(相邻的那个点)连一条边(连一条单向的), 对于每一列中,对于每个点,如果该点下面有点,则向下…
https://codeforces.com/problemset/problem/1000/C 题意: 有n个线段,覆盖[li,ri],最后依次输出覆盖层数为1~n的点的个数. 思路: 区间线段覆盖问题,第一反应树状数组.线段树,看了看数据规模,开不了这么大的空间. 只能用差分了  代码如下: #include <stdio.h> #include <string.h> #include <iostream> #include <string> #incl…