A. Crazy Town 题目连接: http://codeforces.com/contest/498/problem/A Description Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The r…
题目地址 简要题意: 给出两个点的坐标,以及一些一般直线方程Ax+B+C=0的A.B.C,这些直线作为街道,求从一点走到另一点需要跨越的街道数.(两点都不在街道上) 思路分析: 从一点到另一点必须要跨的街道等价于两点一点在这条直线一侧,另一条在另一侧.只需要将两点坐标带进去,一正一负即可.将这些直线依次检验,统计总和. #include<stdio.h> #include<bits/stdc++.h> #include <iostream> using namespac…
Codeforces Round #372 (Div. 2) 不知不觉自己怎么变的这么水了,几百年前做A.B的水平,现在依旧停留在A.B水平.甚至B题还不会做.难道是带着一种功利性的态度患得患失?总共才打的几场 CF 节节掉分.学了快一年了成了个水货. 废话就不多说了,来看这次的这两题吧.很多CF的题是不想写博客的,如果题目质量很好的话我倒是愿意留在我的博客里: A. Crazy Computer time limit per test 2 seconds memory limit per te…
A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have decided to watch the best moments of some movie. There are two buttons on your player: Watch the current minute…
题目链接:http://codeforces.com/contest/499 A. Watching a movie You have decided to watch the best moments of some movie. There are two buttons on your player: Watch the current minute of the movie. By pressing this button, you watch the current minute of…
A. Crazy Town 这一题只需要考虑是否经过所给的线,如果起点和终点都在其中一条线的一侧,那么很明显从起点走点终点是不需要穿过这条线的,否则则一定要经过这条线,并且步数+1.用叉积判断即可. 代码: #include<cstdio> #include<cstring> #include<algorithm> #include<string> #include<map> #define N 100010 #define M 1010 usi…
C. Crazy Town   Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of in…
题目链接: http://codeforces.com/problemset/problem/498/C C. Array and Operations time limit per test1 secondmemory limit per test256 megabytes 问题描述 You have written on a piece of paper an array of n positive integers a[1], a[2], ..., a[n] and m good pair…
因为只有奇偶之间有操作, 可以看出是二分图, 然后拆质因子, 二分图最大匹配求答案就好啦. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int, int> #defin…
D. Name That Tune time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It turns out that you are a great fan of rock band AC/PE. Peter learned that and started the following game: he plays the f…