打猝死场感觉非常作死. A:判一下起点和终点是否在其两侧即可. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; int read() { ,f=;char c=getchar(); ;c=getchar();} )+(x<…
题目链接:1033D - Divisors 题目大意:给定\(n\)个数\(a_i\),每个数的约数个数为3到5个,求\(\prod_{i=1}^{n}a_i\)的约数个数.其中\(1 \leq n \leq 500 , 1 \leq a_i \leq 2\cdot 10^{18}\). 题解:考虑约数个数公式,可以发现对于任意的\(a_i\),有\(a_i=\left\{\begin{matrix}p^2\\ p^3\\ p^4\\ p_1\cdot p_2\end{matrix}\right…
A. King Escape 签. #include <bits/stdc++.h> using namespace std; ], y[]; int f1(int X, int Y) { ] + y[]; } int f2(int X, int Y) { ] + y[] - X - Y; } bool ok() { //if (f1(x[0], y[0]) * f1(x[1], y[1]) < 0) return false; //if (f2(x[0], y[0]) * f2(x[1…
这场比赛好毒瘤哇,看第四题好像是中国人出的,怕不是dllxl出的. 第四道什么鬼,互动题不说,花了四十五分钟看懂题目,都想砸电脑了.然后发现不会,互动题从来没做过. 不过这次新号上蓝名了(我才不告诉你我以前的号是灰名),还是挺高兴的,而且t神这场比赛又成第一了. 比赛传送门:http://codeforces.com/contest/1075 A. The King's Race 题意:有一黑一白两个旗子,白的在(1, 1)上,黑的在(n, n)上.每次可以将旗子移动到周围一圈这八个位置,给你三…
B. Taxi drivers and Lyft time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Palo Alto is an unusual city because it is an endless coordinate line. It is also known for the office of Lyft Level…
夜晚使人着迷.没有猝死非常感动. A:显然对于水平线段,只有横坐标的左端点为1的时候才可能对答案产生影响:对于竖直直线,如果要删一定是删去一段前缀.枚举竖直直线删到哪一条,记一下需要删几条水平线段就可以了.想当然的以为竖直直线横坐标是升序排的,因为这个wa了两发感觉非常惨. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring>…
A---The King's Race http://codeforces.com/contest/1075/problem/A 题意: 一个人在\((1,1)\), 一个人在\((n,n)\), 现在他们每次轮流走一步,问谁先到达\((x,y)\) 思路: 每个人走到\((x,y)\)的步数是可以直接求出的. #include <bits/stdc++.h> #define inf 0x3f3f3f3f using namespace std; typedef long long LL; L…
A. The King's Race 签. #include <bits/stdc++.h> using namespace std; #define ll long long ll n, x, y; ll f(ll a, ll b) { return max(abs(a - x), abs(b - y)); } int main() { while (scanf("%lld%lld%lld", &n, &x, &y) != EOF) { puts(…
https://codeforces.com/contest/1075/problem/C 题意 一个宽为1e9*1e9的矩阵中的左下角,放置一个车(车可以移动到同一行或同一列),放置一些墙,竖的占据一列,横的有一的长度,问车从最下角走到第1e9行最少拆多少面墙? 思路 看了看数据范围以为是一道离散化的题,但是发现车可以往左走 然后再明确了一下题意,墙是永久拆去的,反应到可以优先拆竖着的墙,然后假如剩下横着的墙比竖着的墙少的话,可以直接拆横着的墙 写之前看了一下题意,说横着的墙不会有交点,然后大…
http://codeforces.com/contest/1075/problem/A On a chessboard with a width of nn and a height of nn, rows are numbered from bottom to top from 11 to nn, columns are numbered from left to right from 11 to nn. Therefore, for each cell of the chessboard,…