其他
文章平均质量分 73
birdforever
我是一个纯粹的人,生不带来,死不带走,只为无怨无悔地活一次!
展开
-
poj 1207 The 3n + 1 problem
<br />//poj 1207 The 3n + 1 problem<br />/*<br />照做就对了,把答案先算好,然后每次回答查询就行了。我用的是线段树,很快,0MS解决!<br />*/<br />#include <iostream><br />#include <algorithm><br />using namespace std;<br />struct node<br />{<br /> int l,r,max;<br />}ltree[100000];<br />int原创 2010-08-25 00:07:00 · 418 阅读 · 0 评论 -
poj 1064 Cable master
<br /> // poj 1064 Cable master/* 二分答案就行了。。。*/#include <iostream>#include <algorithm>#include <cmath>using namespace std;const int inf = 1<<29;__int64 a[10010],n,k;int main(){ int b,c; while (scanf("%d%d",&n,&k)!原创 2010-09-05 10:52:00 · 964 阅读 · 0 评论 -
poj 1171 Letter Game
<br />//poj 1171 Letter Game/*好弱的数据,随便处理下都过了。。。 */ #include<iostream>#include <algorithm>using namespace std;int n,m;int s[26]={2,5,4,4,1,6,5,5,1,7,6,3,5,2,3,5,7,2,1,2,4,6,6,7,5,7};int t[26],tp[26];struct node{ char a[8];原创 2010-09-06 00:17:00 · 938 阅读 · 0 评论 -
poj 1079 Ratio
//poj 1079 Ratio/*维护最小误差,枚举每个分母。注意两点:1.输入可能可以约分,这个有案例2.如果出现同分母两个分子都一样更精确,取分子大的*/#include <iostream>#include <algorithm>#include <cmath>using namespace std;const int inf = 1<<28;int n,m;#define eps 0.0000000001int gcd(int n,int m)原创 2010-09-07 16:57:00 · 872 阅读 · 0 评论 -
poj 1027 The Same Game
<br />//poj 1027 The Same Game (模拟)/*题解: 数据量很小的模拟题,直接按题意做就行了。*/#include <iostream>#include <algorithm>#include <cmath>using namespace std;const int inf = 1<<28;int n,m;char str[11][20];int id[11][20],mark[11][20];int move[4][2]={-1,原创 2010-09-07 16:59:00 · 586 阅读 · 0 评论 -
poj 1020 Anniversary Cake
<br />// poj 1020 Anniversary Cake<br />#include <iostream><br />#include <algorithm><br />using namespace std;<br />int n,s,a[11],d[41];<br />bool flag;<br />void dfs(int step)<br />{<br /> if (flag) return ;<br /> if (step==0) { flag=true; return原创 2010-09-04 01:22:00 · 587 阅读 · 0 评论 -
poj 1029 False Coin
// poj 1029 False Coin/*1013的加强版,不过也是直接做。。。一边聊天一边写的,所以代码写得有点粗糙,不过能过就是硬道理,哈哈! */#include #include using namespace std;const int inf = 1")) flag=1; else if (flag==1 && strcmp(op[i],"")) return false;原创 2010-09-04 01:24:00 · 564 阅读 · 0 评论 -
poj 1145 Tree Summing
<br />// poj 1145 Tree Summing/*交了好多遍才过,注意几点:1.输入可能有负数;2.叶子节点判断要准确,是两个子节点都没有的节点;3.空树答案为no*/ #include <iostream>using namespace std;const int inf = 1<<26;const int size = 10000;int n,m;int l[size+10],r[size+10];int c;bool flag;in原创 2010-09-06 00:24:00 · 1134 阅读 · 0 评论 -
poj 2299 Ultra-QuickSort
<br />////poj 2299 Ultra-QuickSort 归并排序/*题解:逆序数,仅此而已。。PS: 水题,还是写了半个小时。*/#include <iostream>#include <algorithm>using namespace std;const int inf = 1<<28;int n,m;int a[500010],temp[500010],ans;void Merge_Sort(int a[],int l,int r)原创 2010-09-21 21:39:00 · 503 阅读 · 0 评论 -
poj 1019 Number Sequence
<br />// poj 1019 Number Sequence <br />#include <iostream><br />#include <algorithm><br />using namespace std;<br /><br />int mi[11];<br />int s[11],ss[11];<br /><br />int main()<br />{<br /> mi[1]=1;<br /> for (int i=2;i<=10;i++) mi[i]=mi[i-1]*10;<原创 2010-09-04 01:20:00 · 373 阅读 · 0 评论 -
poj 1026 Cipher
<br />// poj 1026 Cipher<br />/* <br /> 一直超时,到后来才发现其实很简单,但是代码已经写得很乱了。<br /> 主要是预处理一下,对于每一个i上的字符加密一定次数后,结果会构成一个<br /> 循环,也就是回到i的位置,如果我们求出这个循环周期,并把路径记录下来,<br /> 那么就可以使用取余运算确定最终第i个字符的位置了。<br />*/<br />#include <iostream><br />#include <algorithm><br /原创 2010-09-04 01:24:00 · 455 阅读 · 0 评论 -
poj 1230 Pass-Muraille
//poj 1230 Pass-Muraille 贪心/* 题解:从最左列扫到最右,如果墙数大于k,则把右边界最远的墙去掉。*/#include #include using namespace std;const int size = 10000;const int inf = 1wall[i].r) swap(wall[i].l,wall[i].r); minx=min(wall[i].l,minx); maxx原创 2010-08-26 00:22:00 · 777 阅读 · 0 评论 -
poj1306 Combinations
<br />//poj 1306 Combinations 简单题<br />/*<br />本来想用高精度,后来看数据好小,就直接模拟平时的算法,<br />把上面跟下面大的那一块先约掉不管,然后再算剩余的,这里<br />用了素数分解,可能还有其他方法,不管了,简单题能水就行。<br />*/<br />#include <iostream><br />#include <algorithm><br />using namespace std;<br />const int inf = 1<<28;<b原创 2010-08-24 23:16:00 · 500 阅读 · 0 评论 -
poj 1131 Octal Fractions
<br />//poj 1131 Octal Fractions<br />/* <br />题意:八进制小数到十进制小数的转化<br />题解:(引用aoxboxcox的题解)以0.123为例<br />初始时: 0[8]=0[10]<br />两边加上3[8]: 3[8]=3[10]<br />两边除以8[10]:0.3[8]=0.375[10]<br />两边加上2[8]: 2.3[8]=2.375[10]<br />两边除以8[10]:0.23[8]=0.296875[10]<br />原创 2010-08-25 00:04:00 · 803 阅读 · 0 评论 -
poj 1147 Binary codes
<br />//poj 1147 Binary codes<br />/*<br />就像大家说的,这题很有趣,可惜我天资愚钝,想了好久才有思绪。<br />http://blog.csdn.net/joy32812/archive/2010/06/27/5697056.aspx<br />*/<br />#include <iostream><br />#include <algorithm><br />using namespace std;<br />int a[3001],next[3001];<b原创 2010-08-25 00:05:00 · 791 阅读 · 0 评论 -
poj 1095 Trees Made to Order
<br />//poj 1095 Trees Made to Order 很经典的递归题 <br />/* <br />题解:先判断有多少节点,左右各有多少节点,再递归构造左右子数 <br />做了好几个小时,看到好多人都是三两下清洁溜溜,惭愧至极。。。<br />后来看了别人的题解,才知道自己的思路是完全正确的,只是有个小BUG,<br />哎,真是没自信啊。。。 <br />*/<br />#include <iostream><br />using namespace std;<br />int n,原创 2010-08-24 23:28:00 · 555 阅读 · 0 评论 -
poj 1193 内存分配
<br />//poj 1193 内存分配 (模拟)/*题意:(中文题)模拟内存分配。题解:典型的模拟题:1.维护一个进程的链表,每个节点存有进程开始时间t,进程运行时间p,在内存中的首地址s,占用内存大小m,和下一节点指针。2.维护一个队列,表示还没有空间运行的进程。3.维护一个释放内存的最早时间nexttime,每读入一个新进程的时候,若进程开始时间不小于nexttime,表示有进程在这之前已结束(可能不止一个),将其从链表删除,并循环检测队首进程是否有空间运行,如果原创 2010-09-09 22:51:00 · 1600 阅读 · 0 评论 -
kmp模板
/* 算法导论上的代码字符串是从1开始的,而这个是从0开始的比较符合编程习惯 另一个区别是这里的前缀函数pi[i]表示的是p[0..i]与p[m-i..m]匹配,与算法 导论上表示的长度不同。不过这只是细节上的大同小异。*/char str[size+10];int pi[size+10];void calpi(char p[],int len){ pi[0]=-1; int k=-1; for (int i=1;i=0 && p[k+1]!=p[i原创 2010-09-01 21:39:00 · 376 阅读 · 0 评论 -
poj 1737 Connected Graph
<br />//poj 1737 该题可用于求指定顶点数的无向连通图个数 <br />//膜拜这位仁兄的解题报告:http://hi.baidu.com/accplaystation/blog/item/51417bdca982bea4cc116660.html<br />#include <cstring><br />#include <iostream><br />#include <algorithm><br />using namespace std;<br />const int inf=1<<2原创 2010-09-02 16:06:00 · 1045 阅读 · 0 评论 -
我与Android的故事之- MM应用市场游戏开发
PainterBee-接下来就是见证创意的时刻没有想过,在自己的手机上跑着自己参与创作的游戏。。。 2010年9月份,也就是大三刚开学的时候,我应同学之邀加入了一个移动开发团队,主打Android开发,并参加了一些比赛。刚接触Android开发就爱上了这个平台,不逊色于iphone的酷炫界面,强大的传感器功能,让我目不瑕接。那时除了上课就看Android开发的书,心里一直想开发一个属于原创 2011-07-02 11:45:32 · 2418 阅读 · 3 评论