算是一道比较全面的模板题了吧,需要注意的是:查找比x小的元素个数时x不一定在Treap中,解决办法是插入x,查询,再删除x。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 stru...
分类:
其他好文 时间:
2015-08-02 16:25:48
阅读次数:
170
给出2个数,p和a,2=p时,要break若满足了第一个条件,验证第二个条件,快速幂即可。 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 #define LL long long 8 9 const int maxn...
分类:
其他好文 时间:
2015-08-02 16:24:05
阅读次数:
93
题意:给你数a和数组b,然后用a模b中的数,求至少模多少个才能使a==0
思路:直接模拟吧,首先排序,因为模最大的符合(比如2,3,6)然后遍历b,去模其他的所有数,直到为0,标记退出,否则继续遍历b,循环操作。
#include
#include
#include
#include
#define INF 999999999
using namespace std;
bool c...
分类:
其他好文 时间:
2015-08-02 15:20:35
阅读次数:
146
#include
#include
using namespace std;
int main(int argc, char *argv[]){
string cipher;
while(getline(cin,cipher),cipher!="ENDOFINPUT"){
if(cipher=="START"||cipher=="END"){
continue;
}
str...
分类:
其他好文 时间:
2015-08-02 15:18:17
阅读次数:
124
//一个无向图,每一条路有限制载重和长度
//问从起点到终点的最大载重,以及在最大载重的情况下的最短路是多少
//二分最大栽重,对于每个载重,小于这个载重的路径不走
#include
#include
#include
using namespace std ;
const int maxn = 1010 ;
const int inf = 0x...
分类:
其他好文 时间:
2015-08-02 15:14:17
阅读次数:
102
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 电话运营商电话{ class Program { static void Main(str...
分类:
其他好文 时间:
2015-08-02 15:09:33
阅读次数:
90
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 闰年平年{ class Program { static void Main(string...
分类:
其他好文 时间:
2015-08-02 15:05:07
阅读次数:
103
题目传送门 1 /* 2 题意:问最少翻转几次使得棋子都变白,输出翻转的位置 3 状态压缩+枚举:和之前UVA_11464差不多,枚举第一行,可以从上一行的状态知道当前是否必须翻转 4 */ 5 #include 6 #include 7 #include 8 using na...
分类:
其他好文 时间:
2015-08-02 15:03:49
阅读次数:
118
Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front o...
分类:
其他好文 时间:
2015-08-02 15:02:17
阅读次数:
82
题目传送门 1 /* 2 DFS:因为一行或一列都只放一个,可以枚举从哪一行开始放,DFS放棋子,同一列只能有一个 3 */ 4 #include 5 #include 6 #include 7 using namespace std; 8 9 char maze[10][10];1...
分类:
其他好文 时间:
2015-08-02 15:02:06
阅读次数:
106