CF 593B Anton and Lines(水题)】的更多相关文章

题意是给你n条直线,和x1,x2;问 在x1,x2之间(不包括在x1,x2上) 存不存在任意两条线的交点. 说思路,其实很简单,因为给的直线的条数很多,所以无法暴力求每两条直线的交点,那么就求每条直线与x1,x2的交点, 那么直线1和x1的交点y1与x2的交点y3,直线2与x1的交点y2与x2的交点y4,如果y1>y2,y3>y4,那么画个图就知道肯定不会有交点,反之如果y1>y2,y3<y4,则有交点. 那么求出交点排序,按与x1交点升序排,如果相同的话按与x2交点降序排(此时交…
D. Anton and Chess 题目连接: http://codeforces.com/contest/734/problem/D Description Anton likes to play chess. Also, he likes to do programming. That is why he decided to write the program that plays chess. However, he finds the game on 8 to 8 board to…
A. Anton and Danik 题目连接: http://codeforces.com/contest/734/problem/A Description Anton likes to play chess, and so does his friend Danik. Once they have played n games in a row. For each game it's known who was the winner - Anton or Danik. None of th…
LINK time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In…
B. Anton and Classes 题目连接: http://codeforces.com/contest/785/problem/B Description Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes. Anton has n variants when he wil…
A - Anton and Polyhedrons 题目连接: http://codeforces.com/contest/785/problem/A Description Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons: Tetrahedron. Tetrahedron has 4 triangular face…
B. Anton and Digits 题目连接: http://codeforces.com/contest/734/problem/B Description Recently Anton found a box with digits in his room. There are k2 digits 2, k3 digits 3, k5 digits 5 and k6 digits 6. Anton's favorite integers are 32 and 256. He decide…
[吐槽]:本来没打算写这题的题解的,但惨不忍睹得WA了13次,想想还是记录一下吧.自己的“分类讨论能力”本来就很差. 刚开始第一眼扫过去以为是LIS,然后忽略了复杂度,果断TLE了,说起来也好惭愧,也说明有时候太懒得动脑了,总是习惯利用惯性思维,这不是一件好事. [题意]:给你大小为n的整型数组a[n],求这数组的一个子串,其中最多可以修改子串中的一个数字,使得到的子串是最长的严格递增的子串,输出该子串的长度 L. [思路]:O(n)复杂度,枚举断点情况.第0个和第n个位置默认为断点.(用ve[…
//STL教你做人系列 #include<stdio.h> #include<iostream> #include<math.h> #include<algorithm> using namespace std; ]; int main() { cin>>n; ;i<n;i++) cin>>a[i]; cout<<n<<endl; ;i<n;i++) { int k=min_element(a+i,…
CD 628B 题目大意:给定一个数字(<=3*10^5),判断其能被4整除的连续子串有多少个 解题思路:注意一个整除4的性质: 若bc能被4整除,则a1a2a3a4...anbc也一定能被4整除: 利用这个性质,先特判第一位数字是否能被4整除,可以则++cnt, 之后从第二位数字开始,设当前位为i,先判断a[i]能否被4整除,可以则++cnt, 再判断a[i-1]*10+a[i]能否被4整除,可以则cnt = cnt + (i) 相关证明: 设一整数各个位置为a1,a2,a3,...,an,b…