<题目链接> 题目大意: 给出一个矩形,该矩形的四个顶点分别为:(0,d),(d,0),(n,n−d) and (n−d,n).然后给出一些点的坐标,分别判断这些点是否在该矩形内. 解题分析:开始还以为要用计算几何判断点是否在多边形内的板子,结果发现,给出的矩形四条边方程完全可以很容易的推出来,然后再将该点带入这四个方程,判断是否符合条件即可. #include <cstdio> int main(){ int n,d,m; scanf("%d%d%d",&am…
Vasya is studying number theory. He has denoted a function f(a, b) such that: f(a, 0) = 0; f(a, b) = 1 + f(a, b - gcd(a, b)), where gcd(a, b) is the greatest common divisor of a and b. Vasya has two numbers x and y, and he wants to calculate f(x, y).…
C. Vasya and Basketball 题目链接:http://codeforces.com/problemset/problem/493/C time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya follows a basketball game and marks the distances from whi…
Codeforces 1107G 线段树最大子段和 + 单调栈 G. Vasya and Maximum Profit Description: Vasya got really tired of these credits (from problem F) and now wants to earn the money himself! He decided to make a contest to gain a profit. Vasya has \(n\) problems to choo…
题目链接:http://codeforces.com/contest/493/problem/A 题目意思:给出两个字符串,分别代表 home 和 away.然后有 t 个player,每个player偶四个属性描述:分钟,所属的队名(即上面的两个字符串的其中一个),该player的num,得到的card颜色(y/r). 当一个人得到两个y card 时会自动转为 r card.最终需要按时间先后的顺序输出player第一次获得red card 的时间. 由于数据是按时间先后顺序排列的,那么对于…