摘要:
矩阵BSGS,同样处理即可。 有一个优化可以更快,判断矩阵相等可以$O(n)$。列矩阵的使用。 c++ include using namespace std; typedef long long ll; const int N=71; int n,m,P; struct matrix{ int a 阅读全文
摘要:
一个矩阵,可以横着切S刀,竖着切R刀,求小矩阵和最大的最小是多少。 二分答案,dfs出竖着切的,横着贪心check。 c++ include using namespace std; typedef long long ll; const int maxn = 25; ll a[maxn][maxn 阅读全文
摘要:
A. Pizza Separation 枚举连续的即可。 c++ include using namespace std; using ll=long long; int n,x; int a[780]; int main(){ //freopen("in.txt","r",stdin); scan 阅读全文
摘要:
A Thickest Burger a+b+max(a,b) include using namespace std; typedef long long ll; int main(){ //freopen("in.txt","r",stdin); int n,a,b; while(~scanf(" 阅读全文
摘要:
D What a Beautiful Lake 找递增长度递减长度 1 include define maxn 205 using namespace std; int n; int a[maxn]; int main(){ //freopen("in.txt","r",stdin); while( 阅读全文
摘要:
A ArcSoft's Office Rearrangement 均分石子。 好像怎么分答案都一样,于是模拟一遍。 D Difference 每个k预处理一半,然后用中途相遇法,就是类似尺取。 include using namespace std; typedef long long ll; ll 阅读全文
摘要:
A Wrestling Match 判断二分图,特判没属性的孤点。 D A Simple Math Problem 设$G=gcd(a,b)$。 $gcd(a,b)=gcd(x+y,lcm(x,y))=gcd(x+y,ky)=gcd(x+y,y)=gcd(x,y)$ 那么等式$\frac{x}{G} 阅读全文
摘要:
A Too Rich 给定每一种面值的硬币的个数,求出用最多硬币表示出所给价值。 倒着做可以用前缀和优化和剪枝。 可以$O(1)$算出当前面值减去前缀和之后最少需要几个,然后在此基础上多做3次就可以了,因为前一种硬币最多3枚就可以表示后一种硬币了。 G Dancing Stars on Me 每个点 阅读全文
摘要:
A An Easy Physics Problem Not Easy 啊。 给个射线,和一个圆柱体,射线撞到圆柱体会弹射。判断能否经过给定的点。 折射的时候不能用三角函数旋转,会被卡精度。 $(x,y)$关于直线$ax+by+c=0$的对称点坐标$nx=x 2a\frac{ax+by+c}{a^2+ 阅读全文