题目链接:hdu_4417_Super Mario 题意: 给你n个树,有m个询问,每个询问有一个区间和一个k,问你这个区间内不大于k的数有多少个。 题解: 考虑用主席树的话就比较裸,当然也可以用其他的写 1 #include<bits/stdc++.h> 2 #define F(i,a,b) fo ...
分类:
其他好文 时间:
2016-10-04 01:29:00
阅读次数:
373
#include <bits/stdc++.h> using namespace std; #define maxn 505 #define INF 0x3f3f3f3f struct Edge { int from,to,cap,flow; }; struct Dinic { int n,m,s, ...
分类:
其他好文 时间:
2016-10-03 19:33:35
阅读次数:
365
1、CF #374 (Div. 2) C. Journey 2、总结:好题,这一道题,WA,MLE,TLE,RE,各种姿势都来了一遍。。 3、题意:有向无环图,找出第1个点到第n个点的一条路径,经过的点数要最多。 #include<bits/stdc++.h> #define F(i,a,b) fo ...
分类:
其他好文 时间:
2016-10-02 13:11:22
阅读次数:
129
题目链接:hdu_5908_Abelian Period 题意: 给你n个数字,让你找出所有的k,使得把这n个数字分为k分,并且每份的数字种类和个数必须相同 题解: 枚举k,首先k必须是n的约数,然后就能算出每个数字应该出现多少次,O(n)检验即可。 1 #include<bits/stdc++.h ...
分类:
其他好文 时间:
2016-10-02 00:13:24
阅读次数:
130
Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true. Given num = 5, return f ...
分类:
其他好文 时间:
2016-10-01 21:59:01
阅读次数:
204
题目大意:双向联通图, 现在求减少任意一边使图的联通性改变,按照起点从小到大列出所有这样的边 解题思路:双向边模版题 tarjan算法 代码如下: #include<bits/stdc++.h> using namespace std; const int N = 100003; vector<in ...
分类:
其他好文 时间:
2016-10-01 10:32:51
阅读次数:
134
// My own solutionclass Solution { public: vector<int> countBits(int num) { vector<int> ret = {0}; if(num <= 0) return ret; ret.push_back(1); int i = ...
分类:
其他好文 时间:
2016-09-25 13:09:08
阅读次数:
122
题意:给你一个整数,计算该整数的二进制形式里有多少个“1”。比如6(110),就有2个“1”。 一开始我就把数字n不断右移,然后判定最右位是否为1,是就cnt++,否则就继续右移直到n为0。 可是题目说了是无符号整数,所以给了2147483648,就WA了。 因为java里的int默认当做有符号数来 ...
分类:
其他好文 时间:
2016-09-24 10:40:34
阅读次数:
120
链接:http://bak2.vjudge.net/problem/UVA-12545 分析:贪心乱搞。 ...
分类:
其他好文 时间:
2016-09-22 19:59:06
阅读次数:
148
Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, return fa ...
分类:
其他好文 时间:
2016-09-20 22:28:24
阅读次数:
190