1 #include 2 using namespace std; 3 4 void select_sort(int *p, int n) 5 { 6 int i, j, k; 7 for(i = 0; i p[j])12 {13 ...
分类:
编程语言 时间:
2014-07-22 00:22:33
阅读次数:
216
1 #include 2 using namespace std; 3 4 int main() 5 { 6 void output(int (*p)[4]); 7 int a[3][4]={1,3,5,7,9,11,13,15,17,19,21,23}; 8 outp...
分类:
编程语言 时间:
2014-07-22 00:22:33
阅读次数:
211
#include#include#include#includeusing namespace std;#define N 5505#define M 55000//注意边和点集的数组大小struct edge{ int to,value,next;}edges[M];int heads[N]...
分类:
其他好文 时间:
2014-07-22 00:20:35
阅读次数:
213
指针变量也可以指向一个函数。一个函数在编译时被分配给一个入口地址。这个函数入口地址就称为函数的指针。可以用一个指针变量指向函数,然后通过该指针变量调用此函数 1 #include 2 using namespace std; 3 4 int main() 5 { 6 int max(in...
分类:
编程语言 时间:
2014-07-22 00:18:37
阅读次数:
210
题目链接:uva 1508 - Equipment
题目大意:给出n个5元组,要求从中选取k个,要求5个位置上的数的最大值的和尽量大。
解题思路:对于每个元组,有25?1种选取方法,那么处理出这些选取方法中的最大值即可,然后暴力枚举。
#include
#include
#include
using namespace std;
const int maxn = 10005;...
分类:
其他好文 时间:
2014-07-22 00:17:35
阅读次数:
192
状态压缩从讲完课开始写一直写到三点先是没有考虑结果可能为0(都能放置稻草人的空地)再是鬼使神差地把题目看错N*N是指点数而不是小格数最后莫名其妙的多出了个break完美的做大死现在整个人处于一种要疯癫的状态上代码#include using namespace std;int ABS(int a){...
分类:
其他好文 时间:
2014-07-22 00:16:36
阅读次数:
259
题目链接:uva 1509 - Leet
题目大意:给出k,表示一个字符可以对应k给字符编码,给出字符串1,问时候有符合的编码可以生成字符串2.
解题思路:暴力枚举,对于每个碰到的字符记录对应的编码。
#include
#include
#include
using namespace std;
const int maxn = 105;
const int maxc = ...
分类:
其他好文 时间:
2014-07-22 00:15:33
阅读次数:
216
区域合并时需要考虑两点
1、pushup中区域合并时最左右递增长度(llen/rlen)等于整个区域长度(r - l)时需要重新计算父区域的最左右的递增长度
2、query中需要考虑区域合并接口处是否有可能产生ans值
#include
#include
#include
#include
using namespace std;
const int maxn = 100050;
s...
分类:
其他好文 时间:
2014-07-21 15:45:16
阅读次数:
227
题目来源:POJ 2955 Brackets
题意:最大括号匹配
思路:
#include
#include
#include
#include
using namespace std;
const int maxn = 210;
int dp[maxn][maxn];
char a[maxn];
int b[maxn];
int dfs(int l, int r)
{
if(l ...
分类:
其他好文 时间:
2014-07-21 14:07:05
阅读次数:
178
//不是保证字典序,而是要最小的尽量在前面。
/* 案例
1
4 2
3 1
4 1
3 4 1 2
*/
//- -弱弱备注给自己看
# include
# include
# include
# include
# include
using namespace std;
# define N 30005
vectorg[N];
int vis[N...
分类:
其他好文 时间:
2014-07-21 13:15:36
阅读次数:
158