上一页 1 ··· 4 5 6 7 8
摘要: 题目信息:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=802 利用回溯法求解,但是一直超时。看了CSDN寂静山林用动态规划求解,速度很快。下面是超时的回溯法代码:////2012/2/28////#include<iostream>#include<algorithm>using namespace std;#define MAXSIZE 8void backtrack(int m,int row,in 阅读全文
posted @ 2012-03-02 21:47 AndyDHG 阅读(475) 评论(0) 推荐(0) 编辑
摘要: //题目信息http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1072//本题主要是用动态规划。参考寂静山林的博客,写的非常详细(http://blog.csdn.net/metaphysis/article/details/6860405),这里只是做个个人随笔记录//2012/2/28//accepted//#include<iostream>#include<algorithm>#include< 阅读全文
posted @ 2012-02-28 17:50 AndyDHG 阅读(399) 评论(0) 推荐(0) 编辑
摘要: ////2012/2/27//accepted//从后向前,每次寻找最大得煎饼,如果该煎饼在pancake[0]的位置,则把该煎饼翻转到合适的位置//否则,把该煎饼翻转大pancake[0]的位置,再把该煎饼翻转到合适的位置//5 4 5 3 1 2这组数据,应该先找到pancake[0]位置的5,否则把pancake[2]翻转到pancake[0]就死循环了//这一点在找最大值是控制一下#include<iostream>#include<algorithm>#include<sstream>usingnamespacestd;voidflip(intpo 阅读全文
posted @ 2012-02-28 16:40 AndyDHG 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 题目信息Problem C: WERTYUA common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "J" is typed as "K" and so on. You are to decode a message typed in this manner.Input consists of several 阅读全文
posted @ 2012-02-14 17:46 AndyDHG 阅读(270) 评论(0) 推荐(0) 编辑
摘要: Where's Waldorf? Given a m by n grid of letters, (), and a list of words, find the location in the grid at which the word can be found. A word matches a straight, uninterrupted line of letters in the grid. A word can match the letters in the grid regardless of case (i.e. upper and lower case let 阅读全文
posted @ 2012-02-14 07:45 AndyDHG 阅读(308) 评论(0) 推荐(0) 编辑
摘要: Problem A: Automated Judge Script The ProblemThe judges from the programming contests are known to be very mean and very lazy. We, judges, want less work and more Wrong Answers! So, we'd like you to help us and write an automated judge script to judge solution runs from teams all over the world. 阅读全文
posted @ 2011-12-21 15:49 AndyDHG 阅读(432) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Problem B: Minesweeper The ProblemHave you ever played Minesweeper? It's a cute little game which comes within a certain Operating System which name we can't really remember. Well, the goal of the game is to find where are all the mines within a MxN field. To help you, the game shows a 阅读全文
posted @ 2011-12-18 09:09 AndyDHG 阅读(267) 评论(0) 推荐(0) 编辑
摘要: The 3n + 1 problem BackgroundProblems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is not known for all possible inputs.The ProblemConside. 阅读全文
posted @ 2011-12-17 20:55 AndyDHG 阅读(110) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8