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…
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…
题目链接:http://codeforces.com/contest/493/problem/A 题目意思:给出两个字符串,分别代表 home 和 away.然后有 t 个player,每个player偶四个属性描述:分钟,所属的队名(即上面的两个字符串的其中一个),该player的num,得到的card颜色(y/r). 当一个人得到两个y card 时会自动转为 r card.最终需要按时间先后的顺序输出player第一次获得red card 的时间. 由于数据是按时间先后顺序排列的,那么对于…
咸鱼了好久...出来冒个泡_(:з」∠)_ 题目连接:1107G - Vasya and Maximum Profit 题目大意:给出\(n,a\)以及长度为\(n\)的数组\(c_i\)和长度为\(n\)的严格单调上升数组\(d_i\),求\(\max\limits_{1 \le l \le r \le n} (a\cdot(r-l+1)-\sum_{i=l}^{r}c_i-gap(l,r))\),其中\(gap(l, r) = \max\limits_{l \le i < r} (d_{i…
B. Vasya and Wrestling time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by…
题目描述 Let's denote as L(x,p)L(x,p) an infinite sequence of integers yy such that gcd(p,y)=1gcd(p,y)=1 and y>xy>x (where gcdgcd is the greatest common divisor of two integer numbers), sorted in ascending order. The elements of L(x,p)L(x,p) are 11 -ind…
题目链接:http://codeforces.com/problemset/problem/460/A 题目意思:有一个人有 n 对袜子,每天早上会穿一对,然后当天的晚上就会扔掉,不过他会在 m 的倍数所代表的天数(1m,2m,3m...)会购入一双袜子,不过是在那一天的晚上买.问他拥有的袜子够他穿几天. 首先他是晚上扔掉,早上穿,晚上买这些信息是无关紧要的,好像不影响解题,不要太纠结......这题最关键的是,他穿完 他本来购入的 n 对袜子后,又再购入的情况,因为假设他在前 n 日(也就是m…
水题 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; +; char s1[maxn],s2[maxn]; int a[maxn],b[maxn]; int lena,lenb; int c; int main() { scanf("%s%s",s1,s2); lena=strlen(s1); lenb=strlen(s2); c=; ;i>…
<题目链接> 题目大意: 给出一个矩形,该矩形的四个顶点分别为:(0,d),(d,0),(n,n−d) and (n−d,n).然后给出一些点的坐标,分别判断这些点是否在该矩形内. 解题分析:开始还以为要用计算几何判断点是否在多边形内的板子,结果发现,给出的矩形四条边方程完全可以很容易的推出来,然后再将该点带入这四个方程,判断是否符合条件即可. #include <cstdio> int main(){ int n,d,m; scanf("%d%d%d",&am…