BaoBao has just found a rooted tree with n vertices and (n-1) weighted edges in his backyard. Among the vertices, of them are red, while the others ar ...
分类:
其他好文 时间:
2018-09-19 23:39:15
阅读次数:
430
题目链接 题意 : 给出若干个物品的数量和单个的重量、问你能不能刚好组成总重 S 分析 : 由于物品过多、想到二进制优化 其实这篇博客就是存个二进制优化的写法 关于二进制优化的详情、百度一下有更多资料 #include<bits/stdc++.h> #define LL long long #def ...
分类:
其他好文 时间:
2018-09-19 21:49:53
阅读次数:
171
给一颗树,其中树中有一些红色的点,每个点到距离它最近的祖先红点的距离称为它的距离。 每次给一个点子集,可以选择把树中任意一个点变为红色,问怎样让子集里的点的距离最大值最小。 当只有两个点时,肯定是先找到他们的 lca 然后先判断将 lca 染红是否可以让最大的距离变小,如果有一个点的祖先红点在 lc ...
分类:
其他好文 时间:
2018-09-17 15:21:14
阅读次数:
133
God Water likes to eat meat, fish and chocolate very much, but unfortunately, the doctor tells him that some sequence of eating will make them poisono ...
分类:
其他好文 时间:
2018-09-17 11:45:18
阅读次数:
307
```cpp #include using namespace std; #define rep(i,a,b) for(int i=a;i256){flag=false;break;} bool what=false; switch(con[i][0]) { case 2... ...
分类:
其他好文 时间:
2018-09-16 20:58:41
阅读次数:
165
把这题的每个点分成两种情况看,如果是从这个点开始,0算作2,1算作1,如果是中间点或者是结束点,如果和前面的相同看作2,不相同看作1 ...
分类:
其他好文 时间:
2018-09-16 20:51:34
阅读次数:
297
Now you have a string consists of uppercase letters, two integers AA and BB. We call a substring wonderful substring when the times it appears in that ...
分类:
其他好文 时间:
2018-09-16 15:59:07
阅读次数:
366
欧拉降幂求(A^B)%C,其中B超大。 //#define test #include<bits/stdc++.h> using namespace std; const int Nmax=1e6+7; typedef long long ll; const ll mod = 1e9+7; char ...
分类:
其他好文 时间:
2018-09-16 15:54:51
阅读次数:
165
water #include <bits/stdc++.h> using namespace std; int n,a,b,c; int main(){ while(~scanf("%d%d%d",&a,&b,&c)){ int ans=a*b*c; if(ans%2==0) printf("Yes ...
分类:
其他好文 时间:
2018-09-16 15:54:07
阅读次数:
145