P2997 [USACO10NOV]旗帜Banner 题目背景 题目大意(by:曹彦臣): 平面上有(0,0)到(n,m)的(n+1)*(m+1)个点.问有多少点对所连的线段不过其他点,且长度在[l,h]范围内. 征求翻译.如果你能提供翻译或者题意简述,请直接发讨论,感谢你的贡献. 题目描述 Bessie is returning from a long trip abroad, and Farmer John wants to erect a nice 'Welcome Home' banne…
P2996 传送门 题意: 给你一棵树,每一条边上最多选一个点,问你选的点数. 我的思想: 一开始我是想用黑白点染色的思想来做,就是每一条边都选择一个点. 可以跑两边一遍在意的时候染成黑,第二遍染成白,取一个最大值. 就可以得到\(30\)分的高分. #include <bits/stdc++.h> #define N 100010 #define M 1010 #define _ 0 using namespace std; int n, tot, ans, add_edge, color[…
题目链接 长和宽的gcd(x,y)=1,就没有中间结点,一种线段有两种方向,暴力统计一下就好了 注意x=0或y=0时的线段只有一种方向 #include<iostream> #include<cstring> #include<cstdio> #include<cmath> #define int long long using namespace std; int L1,L2,W,H,ans; inline int gcd(int a,int b){ if…