摘要:
题目意思简单,思路也挺简单的,可是打代码可不容易,我已经WA一下午了,至今没有AC,希望路过的大牛帮忙测测,将测试数据发给我,我将感激不尽……/* * hdu3925/win.cpp * Created on: 2011-9-20 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>using namespace std;const int MAX = 100000000;int ans;char stra[200], strb 阅读全文
摘要:
题目不难,比赛的时候一读完题目我就知道怎样做了,可是打了一个小时,原因是BF算法居然记不清了,唉,早知道干脆用KMP了。可是打完以后还一直不过,让其它几个队帮我测试,测了一个多小时还是没有找到错误。离比赛结束只有一个小时的时候,让海峰帮我测,终于找到错误,改正就过了。唉,这次比赛的悲剧也就在我,在这题上了吧,花了太多时间。/* * 2011BeijingG/win.cpp * Created on: 2011-9-18 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring> 阅读全文
摘要:
这题题意好纠结,半天没看懂,后来打完过不了样例,让海峰读题,最后按他的思路打完了,居然在他之前AC,哈哈~读懂了题目还是挺简单的,首先求出所有点到终点的最短路,然后DP一下,就能求出路径条数。/* * hdu1142/linux.cpp * Created on: 2011-9-17 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>using namespace std;c 阅读全文
摘要:
/* * hdu1872/win.cpp * Created on: 2011-9-11 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>using namespace std;typedef struct { char name[55]; int score;} Student;bool operator<(const Student &s1, const 阅读全文
摘要:
判断一个环形的字符串是否对称,其实只需要一一尝试以每一个字符作为中间位置即可。/* * hdu3793/win.cpp * Created on: 2011-9-11 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>using namespace std;const int MAXN = 105;char str[MAXN];void work();int main() { 阅读全文
摘要:
题目很水,直接用Floyd即可/* * hdu3786/win.cpp * Created on: 2011-9-6 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>using namespace std;#define SIZE 100#define MAX 0x7fffffffint map[SIZE][SIZE];int N;void init() { int i, 阅读全文
摘要:
题目很简单,可是打了一个小时,这种题目真是悲剧啊/* * hdu3788/win.cpp * Created on: 2011-9-6 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>using namespace std;const int MAXN = 1010;bool judge(char *s, int len) { if (len < 3) { retur 阅读全文
摘要:
一开始想到的办法,对每个序列建立二叉排序树后先根遍历看得到的序列是否相同即可。打完后忽然想到,其实既然我用数组存下了二叉树,那么直接比较树是否完全一样就可以了的,算了就这样吧,以后再打……/* * hdu3791/linux.cpp * Created on: 2011-9-6 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>using namespace std;type 阅读全文
摘要:
本来以为是求逆序数,要用归并排序,而且还得用线段树动态维护神马的,睁大眼睛一看,我滴妈呀,n才5000,直接暴力过了~~/* * hdu1394/linux.cpp * Created on: 2011-9-6 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>using namespace std;const int MAXN = 5010;int num[MAXN], r 阅读全文
摘要:
本来想找些树状数组的题做做,看到这题,不知道用树状数组的话应该如何做,就还是用线段树了。/* * hdu1754/win.cpp * Created on: 2011-9-6 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>using namespace std;const int MAXN = 200100;const int MAX_NODE = 400100;int 阅读全文