symons

___________每一天都是幸福的!!

  博客园  ::  :: 新随笔  ::  :: 订阅 订阅  :: 管理

2013年4月7日

摘要: 求出六个雪花叶子的长度,然后取模。这个是我第一次写哈希,也不太会啊,所以就参考了一下别人的代码,我感觉他的代码写的好文艺啊。 挺不错的,我以后也要注意代码格式问题了。 1 #include <iostream> 2 #include <stdio.h> 3 #include <stdlib.h> 4 #include <vector> 5 #define maxn 100005 6 #define mod_val 90001 7 using namespace std; 8 9 vector<int>hash[mod_val];10 阅读全文
posted @ 2013-04-07 23:17 symons 阅读(181) 评论(0) 推荐(0)

2013年3月31日

摘要: 转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents by---cxlove可惜没有机会去现场做,不过当时肯定是不会。题意:有N堆石头,可以把两堆合成一堆,也可以把一堆去掉一个。由于总数不变,最终总是要一个个拿完。那么有机会获胜的一方,肯定是先要把所有的合在一起,那么最终就拼奇偶数了。所以双方都要合并。总共就是sigma(ai)+n-1。而且如果没有某堆只有一个的话,对方是阻挡不住的,没有取完,便被合并了。所以就要考虑某堆只有一个的情况,单独考虑。其中的操作包括:把某堆只有一个的,取走把两堆只有一个的,合并把某堆只有一个的,合并 阅读全文
posted @ 2013-03-31 20:03 symons 阅读(304) 评论(0) 推荐(0)

2013年3月30日

摘要: 之前用的LA,LB写的标记,表示x,y坐标之前的状态,我发现我写错了,这样的话会忽略很多组合,组合起来又是不同的了,本来可以有10^4,如果那样写就只有100*2的状态了,而且步行,所以我用了一个办法,L[t1.x*100+t1.y]=t.x*100+t.y; 这样压缩表示状态挺好的。知道错在哪里了然后就过了。 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #include <string> 5 #include <map> 6 #include 阅读全文
posted @ 2013-03-30 17:20 symons 阅读(291) 评论(0) 推荐(0)

2013年3月22日

摘要: 模拟,下楼梯不用停。 1 #include <iostream> 2 #include <stdio.h> 3 #include <cmath> 4 #include <string.h> 5 using namespace std; 6 int step[100+10]; 7 int main() 8 { 9 int c;10 int n,i,j,cnt,maxstep;11 int temp;12 while(~scanf("%d",&c))13 {14 while(c--)15 {16 sca... 阅读全文
posted @ 2013-03-22 19:07 symons 阅读(292) 评论(0) 推荐(0)

摘要: 这题是完全背包。我没有优化。 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #include <string.h> 5 #include <cmath> 6 #define maxn 100+10 7 #define maxC 100000+10 8 using namespace std; 9 int f[maxC];10 int c[maxn];11 int v[maxn];12 int main()13 {14 int n,i,j;15 in 阅读全文
posted @ 2013-03-22 18:53 symons 阅读(499) 评论(0) 推荐(0)

摘要: 听说腾讯的编程马拉松启动了,然后我一直准备报名,然后不知道为啥等我报名那一天就没有位置了...无奈了,校赛我也是昨天刚报上名。我在想什么呢?!在HDU上找题目做来看看。这题就是模拟了。注意时间循环的时候是for(i=beign;i<end;++i)这块一定是i<end,不然会出错的。 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #define maxn 24*60+100 5 using namespace std; 6 bool daytime[maxn] 阅读全文
posted @ 2013-03-22 18:34 symons 阅读(301) 评论(0) 推荐(0)

摘要: 近期刷题列表,列表转自大牛 初期:一.基本算法:(1)枚举. (poj1753,poj2965) ★(2)贪心(poj1328,poj2109,poj2586) ★(3)递归和分治法.(4)递推.(5)构造法.(poj3295)(6)模拟法.(poj1068★,poj2632★,poj1573★,p 阅读全文
posted @ 2013-03-22 12:53 symons 阅读(497) 评论(0) 推荐(0)

2013年3月20日

摘要: 本题就直接模拟就OK啦,停止有2个条件,一个条件是达到目的串,另一个条件就是S1经过多次模拟又回到原始串。题意不太好懂。那我就说一下吧。就是经过shuffle,split,两个步骤,不断的进行这两个步骤,知道出现可以触发停止的条件位置。 1 #include <iostream> 2 #include <string> 3 #include <string.h> 4 #include <stdio.h> 5 using namespace std; 6 int l; 7 void split(string &t1,string & 阅读全文
posted @ 2013-03-20 21:15 symons 阅读(262) 评论(0) 推荐(0)

摘要: 这题就是宽搜,枚举每个点,但是要注意num[0](千位的位置)不能为0需要判断一下,然后再优化一下,就OK了。如果不优化的话,就会TLE。 1 #include <stdio.h> 2 #include <cmath> 3 #include <iostream> 4 #include <string.h> 5 #include <queue> 6 using namespace std; 7 struct node 8 { 9 int num[4];10 int step;11 };12 bool isPrim[10000+10];1 阅读全文
posted @ 2013-03-20 19:10 symons 阅读(160) 评论(0) 推荐(1)

2013年3月19日

摘要: 这题用了一个优化避免了大数运算。宽搜只搜0和1,找能整除n的只有0,1的十进制数。所以只要mod就可以了,然后就可以把每一个点的模都求出来,然后再*10+1或者*10+0存起来,如果能整除n的话,返回,否则继续找。反正大体上就是这个思路。然后直接提交就超时了,然后我就打了表。 1 #include <string> 2 #include <iostream> 3 #include <queue> 4 using namespace std; 5 6 struct node 7 { 8 string temp; 9 int rem;10 };11 int n; 阅读全文
posted @ 2013-03-19 14:40 symons 阅读(239) 评论(0) 推荐(0)