枚举其实很重要,特别是在应用开发初期,服务器端数据格式需要更改得情况下,枚举和宏都能是程序简洁,并且改动小。网上有个人写的言简意赅,适合初学转自:http://blog.csdn.net/ysy441088327/article/details/8012677题记:
蛋疼的枚举, 千万别小视了! 进...
分类:
移动开发 时间:
2014-05-26 22:47:49
阅读次数:
257
/*代码一:DFS+Enum*///Memory Time //240K 344MS
//本题只要求输出翻转的次数,因此BFS或DFS都适用#includeusing namespace std;bool
chess[6][6]={false};//利用的只有中心的4x4bool flag;in.....
分类:
其他好文 时间:
2014-05-26 22:45:54
阅读次数:
323
The game “The Pilots Brothers: following the stripy
elephant” has a quest where a player needs to open a refrigerator.There are 16
handles on the refr...
分类:
其他好文 时间:
2014-05-26 22:16:23
阅读次数:
329
DescriptionFreddy Frog is sitting on a stone in
the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another
stone. He plans to visi...
分类:
其他好文 时间:
2014-05-26 21:55:01
阅读次数:
352
看到这种填合适的运算符之类的题目,第一感觉就是用dfs来枚举递归。
但邮箱道题目算法设计里面那么大的数据,想到有可能会超时。
用最直白的简单的方法dfs一遍后交上,超时。
——需要判重和边界结束条件。
在所有能剪断的地方痛下狠手,狂加特判+return;
然后就炒鸡快了
#include
#include
#include
#define ADD 32000
using namespa...
分类:
其他好文 时间:
2014-05-23 02:06:42
阅读次数:
285
刷了这么长时间POJ了 可算看到了一个中文题,不容易啊~~。
题目大意:自己看。
解题思路:
dp[x1][y1][x2][y2][num]代表从(x1,y1)到(x2,y2)分成num+1块最小的平方和是多少。
下面是代码:
#include
#include
#include
int sum[10][10],board[10][10];
d...
分类:
其他好文 时间:
2014-05-22 23:06:07
阅读次数:
300
题意:给你个矩阵,里面有n个标记的点,许多只青蛙在上面跳,每次跳的距离都是一样的且轨迹是直线,目标是从一边跳到另一边,求最多步数的青蛙
思路:排序后,枚举判断
#include
#include
#include
#include
using namespace std;
const int MAXN = 5050;
struct point{
int x,y;
void ini...
分类:
其他好文 时间:
2014-05-22 18:50:02
阅读次数:
255
Hotel
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 10959
Accepted: 4732
Description
The cows are journeying north to Thunder Bay in Canada to gain cul...
分类:
其他好文 时间:
2014-05-22 18:29:19
阅读次数:
237
Description
两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面...
分类:
其他好文 时间:
2014-05-22 17:35:34
阅读次数:
214
题目:http://poj.org/problem?id=1226
http://acm.hdu.edu.cn/showproblem.php?pid=1238
其实用hash+lcp可能也可以,甚至可能写起来更快,不过我没试,我最近在练习后缀数组,所以来练手
后缀数组的典型用法之一----------------后缀数组+lcp+二分
思路:1、首先将所有的字符串每读...
分类:
其他好文 时间:
2014-05-22 17:14:08
阅读次数:
289