Codeforces 593B Anton and Lines】的更多相关文章

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…
题意是给你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交点降序排(此时交…
B. Anton and Lines Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/593/problem/B Description The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforc…
B. Anton and Lines   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 the task he was given a set of n lines defined by the equations y = ki·x + bi. It was necess…
Anton and Lines 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 Cod…
E. Anton and Tree time limit per test: 3 seconds memory limit per test :256 megabytes input:standard input output: standard output Anton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph. There are …
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 too simple, he uses an infinite one instead. The first task he faced is to check…
[题目链接] http://codeforces.com/problemset/problem/734/F [题目大意] 给出数列b和数列c,求数列a,如果不存在则输出-1 [题解] 我们发现: bi+ci=2n*ai-(所有ai为1且aj为0的数位)+(ai为0且aj为1的数位)= n*ai+Σak 记为(1)式 同时又有(ai为1且aj为0的数位)+(aj为1且ai为0的数位)=ai xor aj 那么Σ(bi+ci)=Σ(2n*ai)-Σ(ai xor aj)+Σ(ai xor aj)=Σ…
Description As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn different sequences that consist of round brackets (characters "(" and &quo…
题目链接:https://codeforces.com/problemset/problem/785/D 题解: 首先很好想的,如果我们预处理出每个 "(" 的左边还有 $x$ 个 "(",以及右边有 $y$ 个 ")",那么就有式子如下: ① 若 $x+1 \le y$:$C_{x}^{0} C_{y}^{1} + C_{x}^{1} C_{y}^{2} + \cdots + C_{x}^{x} C_{y}^{x+1} = \sum_{i=0}…