- 博客(16)
- 资源 (5)
- 收藏
- 关注
原创 Mike and Feet(单调栈)
Description Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left
2016-07-29 17:57:25 493
原创 sort对string类型排序
我学到的姿势:我开始把string类型的a用成数组那样来排序,如: sort(a,a+5); 后面发现这样会报错。 实在是太蠢了。 后面认识到,string是一个类,类的用法是用’.’号来用的,下面放上正确用法:#include <iostream>#include <string>#include <algorithm>using namespace std;int main(){
2016-07-29 11:09:46 6042 1
原创 map中自定义比较函数
转载自:http://blog.csdn.net/smallacmer/article/details/7478891首先对于map如果采用默认的比较函数,是按键值由小到大插入元素的。。 set和map集合容器实现了红黑树的平衡二叉检索树的数据结构,平衡二叉检索树使用中序遍历的算法。#include<set> #include<iostream> #include<string> #i
2016-07-29 09:44:59 2330
原创 统计难题(字典树还有一种是看起来很简洁的stl)
Time Limit:2000MS Memory Limit:65535KB 64bit IO Format:%I64d & %I64u 这道题作为字典树的理解题最好不过了。DescriptionIgnatius最近遇到一个难题, 老师交给他很多单词( 只有小写字母组成, 不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量( 单词本身也是自己的前缀).Inp
2016-07-28 13:26:44 503
原创 Balanced Lineup(线段树)
Time Limit:5000MS Memory Limit:65536KB 64bit IO Format:%lld & %lluDescription For the daily milking, Farmer John’s N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John
2016-07-27 23:32:05 223
原创 BFS
模板思路:这里利用了结构体队列来保存每一个情况下的坐标x和步数。然后从里面取出来判断,取出来后还要就这个点的坐标x再去对每一种情况来变化,变化后的每一种不重复的情况又保存进队列里面,依次重复上述步骤。然后当第一次==判断成立时,就是我们的最短的步数。就可以返回了。#include <iostream>#include <cstring>#include <cstdlib>#include <c
2016-07-26 13:29:19 260
原创 DFS与BFS
DFS:#include <iostream>#include <string.h>#include <queue>#include <algorithm>#include <cmath>#include <cstdio>#define MAXN 100using namespace std;char a[MAXN+5][MAXN+5];int k,n,m;int dx[]={1,0
2016-07-25 22:54:06 231
原创 发糖果
Description 有n个小朋友站成一排,他们每个人手上都拿有一些糖果,现在我们要进行m次下面的操作: 1. 发给第i个小朋友x个糖果 2. 查询区间[L, R]内拥有最多糖果的小朋友的糖果数量 Input 第一行n,m (1 <= n,m <= 100000) 第二行有n个数,a[i],初始第i个小朋友手上的糖果数量 (0 < a[i] <= 100000) 接下来m行
2016-07-25 10:19:53 405
转载 Again Prime? No Time.
The problem statement is very easy. Given a number n you have to determine the largest power of m,not necessarily prime, that divides n!.InputThe input file consists of several test cases. The first
2016-07-22 17:10:12 264
原创 质因数分解
(1)如果这个质数恰等于n,则说明分解质因数的过程已经结束,打印出即可。 (2)如果n<>k,但n能被k整除,则应打印出k的值,并用n除以k的商,作为新的正整数你n, 重复执行第一步。 (3)如果n不能被k整除,则用k+1作为k的值,重复执行第一步。#include <cstdio>#include <iostream>int main(){ int n,i; printf("
2016-07-22 12:38:05 315
原创 How do you add?(dp)
题目: Larry is very bad at math — he usually uses a calculator, which worked well throughout college. Unforunately, he is now struck in a deserted island with his good buddy Ryan after a snowboarding
2016-07-21 22:06:34 490
原创 Expect the Expected(dp+概率)
问题:Some mathematical background. This problem asks you to compute the expected value of a random variable. If you haven’t seen those before, the simple definitions are as follows. A random variable is
2016-07-21 16:08:15 656
原创 dp对组合数的预处理和快速幂取模模板
代码部分: for(int i=0;i<=2000;i++){ dp[i][1]=i%1007;//C(n,1)=n; dp[i][0]=dp[i][i]=1;//C(n,0)=C(n,n)=1; } for(int i=2;i<=2000;i++){ for(int j=1;j<=i;j++){ dp[i
2016-07-20 16:21:05 1236
原创 辗转相除法(最大公约数)
作为数学问题中的基本算法,它扮演者重要的角色。 简单的形式: int GCD(int a,int b) { if(b==0) return b; return GCD(b,a%b) } 还有一种分解的: int GCD(int a,int b) { int r;
2016-07-19 22:39:34 275
原创 memset对int型数组的处理
本文是从http://blog.csdn.net/bresponse/article/details/6910990转载 如下demo是可以的,能把数组中的元素值都设置成字符1,#include <iostream>#include <cstring>using namespace std;int main(){ char a[5]; memset(a,'1',5);
2016-07-19 17:33:15 4513
VA2333.rar
2019-09-06
Unity音乐插件Koreographer Professional Edition 1.5版本
2019-08-15
WinHex19.1
2018-08-13
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人