摘要: 深搜,亮点在那个剪枝,flag代表是否搜索数组从开始到当前一直等于原始数组同位置的数,如果是真,就从原始数组的当前位置的书开始搜,否则就从0开始搜。见代码。#include #include using namespace std;int n,m,beg,origin[2003];int mp[103][103];bool vis[103][103];int cnt;int stk[2010];bool check(){ int i; for(i=0;iorigin[i]) return true; } return false;}void dfs(... 阅读全文
posted @ 2013-11-09 15:30 Al J 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 杭州现场赛的题。BFS+DFS#include #include#include#define inf 9999999using namespace std;char mp[105][105];int sq[5][5];int step[4][2]={{0,1},{1,0},{0,-1},{-1,0}};struct pos{ int x,y;};int n,m,prn,x,y,tmp,ans,cnt;bool viss[5];int bfs(pos bg,pos ed){ int i; pos que[20000]; int front=0,rear=1; bo... 阅读全文
posted @ 2013-11-09 15:24 Al J 阅读(213) 评论(0) 推荐(0) 编辑
摘要: E -Domino PrincipleTime Limit:2000MSMemory Limit:262144KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeCodeForces 56EDescriptionVasya is interested in arranging dominoes. He is fed up with common dominoes and he uses the dominoes of different heights. He putndominoes on the table along one ax 阅读全文
posted @ 2013-11-07 14:45 Al J 阅读(634) 评论(0) 推荐(0) 编辑
摘要: 最近一直在看书和博客,即使做出几道题来也是看别人题解写的,感觉没自己的东西,所以很久没更新博客看了很多数位dp的题和题解,发现数位dp题是有固定的模版的,并且终于自己做出来一道。我觉得用记忆化搜索写数位dp很巧妙,而且容易想,且有一定模版,很好用。Round NumbersTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 7659Accepted: 2637DescriptionThe cows, as you know, have no fingers or thumbs and thus are unable to play 阅读全文
posted @ 2013-10-16 10:43 Al J 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Shredding CompanyTime Limit : 2000/1000ms (Java/Other)Memory Limit : 20000/10000K (Java/Other)Total Submission(s) : 8Accepted Submission(s) : 7Problem DescriptionYou have just been put in charge of developing a new shredder for the Shredding Company Although a "normal" shredder would just 阅读全文
posted @ 2013-09-29 19:49 Al J 阅读(227) 评论(0) 推荐(0) 编辑
摘要: PotsTime Limit : 2000/1000ms (Java/Other)Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 21Accepted Submission(s) : 9Special JudgeProblem DescriptionYou are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot 阅读全文
posted @ 2013-09-29 11:00 Al J 阅读(160) 评论(0) 推荐(0) 编辑
摘要: SudokuTime Limit : 4000/2000ms (Java/Other)Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 8Accepted Submission(s) : 8Special JudgeProblem DescriptionSudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In s 阅读全文
posted @ 2013-09-28 18:27 Al J 阅读(268) 评论(0) 推荐(0) 编辑
摘要: Curling 2.0Time Limit : 2000/1000ms (Java/Other)Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 22Accepted Submission(s) : 10Problem DescriptionOn Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is 阅读全文
posted @ 2013-09-27 20:43 Al J 阅读(218) 评论(0) 推荐(0) 编辑
摘要: Dungeon MasterTime Limit : 2000/1000ms (Java/Other)Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 18Accepted Submission(s) : 12Problem DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be fille 阅读全文
posted @ 2013-09-24 20:16 Al J 阅读(273) 评论(0) 推荐(0) 编辑
摘要: Prime PathTime Limit : 2000/1000ms (Java/Other)Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 15Accepted Submission(s) : 13Problem DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-di 阅读全文
posted @ 2013-09-24 18:46 Al J 阅读(236) 评论(0) 推荐(0) 编辑