- 博客(13)
- 收藏
- 关注
原创 POJ_1617_Crypto Columns
<br />#include <iostream>#include <string>#include <algorithm>using namespace std;char key[11];char word[11][11];char str[101];struct INDEX{ int index; bool operator<(const INDEX& o)const { return key[this->index]<key[o.index]; }
2010-08-29 16:59:00 651
原创 POJ_3051_Satellite Photographs
<br />#include <iostream>using namespace std;int w, h;int step[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};int visit[1001][81];char map[1001][81];int ans;bool Check(int x, int y){if (x >= h || x < 0 || y >= w || y < 0)return false;retu
2010-08-28 20:01:00 536
原创 POJ_3194_Equidivisions
<br />#include <iostream>using namespace std;int N, ans;int map[101][101];int visit[101][101];int step[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};int color[101];bool Check(int x, int y){ if (x >= N || x < 0 || y >= N || y < 0) return f
2010-08-28 18:26:00 678
原创 POJ_3125_Printer Queue
<br />#include<iostream>#include<queue>using namespace std;int main(){ int t, n, m, x; cin>>t; while(t--) { cin>>n>>m; queue<int>q; priority_queue<int>v; for(int i=0; i<n; i++) { cin>>x; q.push(x); v.push(x);
2010-08-28 16:54:00 551
原创 POJ_1606_Jugs
<br />#include <iostream>using namespace std;int A, B, C;struct { int i; int j; int method;}visit[1001][1001];struct{ int a; int b; int deep;}queue[100001];int result;int ra, rb;void Show(int a, int b){ int method =
2010-08-28 16:23:00 672
原创 POJ_1056_IMMEDIATE DECODABILITY
<br />#include <iostream>#include <vector>#include <string>#include <algorithm>using namespace std;int main(){ freopen("test.txt", "r", stdin); int n; vector<string> v; string s; int t = 1; while (cin>>s) { if (s[0] == '9')
2010-08-26 01:00:00 552
原创 POJ_3510_A Tale from the Dark Side of the Moon
#include #include using namespace std;int main(){ freopen("test.txt", "r", stdin); while(true) { string s1; string s2 = ""; getline(cin, s1); int l = s1.length(); bool flag = true; for (int i = 0; i
2010-08-26 00:35:00 748
原创 POJ_3356_AGTC
<br />#include <iostream>#include <string>using namespace std;string s1, s2;int l1, l2;int LCS(int x, int y){ if (x >= l1 || y >= l2) return 0; if (s1[x] == s2[y]) return 1+LCS(x+1, y+1); return max(LCS(x, y+1), LCS(x+1, y));}
2010-08-26 00:29:00 381
原创 POJ_3630_Phoe List
水题#include using namespace std;char phone[10001][11];int cmp(const void* a, const void* b){ return strcmp((char*)a, (char*)b);}int main(){ int t, n; freopen("test.txt", "r", stdin); scanf("%d", &t); while (t--) { scanf("%d"
2010-08-25 20:14:00 405
转载 N!后0的个数
<br />问题描述<br />给定参数n(n为正整数),请计算n的阶乘n!末尾所含有“0”的个数。<br />例如,5!=120,其末尾所含有的“0”的个数为1;10!= 3628800,其末尾所含有的“0”的个数为2;20!= 2432902008176640000,其末尾所含有的“0”的个数为4。<br /><br />计算公式<br />这里先给出其计算公式,后面给出推导过程。<br />令f(x)表示正整数x末尾所含有的“0”的个数,则有:<br /> 当0 < n < 5时,f(n!) =
2010-08-24 13:12:00 1115
转载 C++类构造函数初始化列表
C++类构造函数初始化列表构造函数初始化列表以一个冒号开始,接着是以逗号分隔的数据成员列表,每个数据成员后面跟一个放在括号中的初始化式。例如:class CExample {public: int a; float b; //构造函数初始化列表 CExample(): a(0),b(8.8) {} //构造函数内部赋值 CExample() { a=0; b=8.8; }};上面的例子中两个构造函数的结果是一样的。上面的构造函
2010-08-18 16:43:00 611
原创 POJ_1112_Team Them Up!
#include #define inf 1000000using namespace std;const int MAXN = 101;int map[MAXN][MAXN];int id[2][MAXN];int color[MAXN];int dp[MAXN][MAXN];int tmp[MAXN][MAXN];struct { int c1, c2; int i, j;}pre[MAXN][MAXN];int N, t;bool DFS(
2010-08-04 21:41:00 2223
转载 A*寻路初探(转)
<br />A*寻路初探 GameDev.net<br />作者: Patrick Lester<br />译者:Panic 2005年3月18日<br />译者序:很久以前就知道了A*算法,但是从未认真读过相关的文章,也没有看过代码,只是脑子里有个模糊的概念。这次决定从头开始,研究一下这个被人推崇备至的简单方法,作为学习人工智能的开始。<br />这篇文章非常知名,国内应该有不少人翻译过它,我没有查找,觉得翻译本身也是对自身英文水平的锻炼。经过努力,终于完成了文档,也明白的A*算法的原理。
2010-08-04 21:18:00 569
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人