摘要: Problem DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the land into numerous square plots. It then analyzes each plot separately, using s 阅读全文
posted @ 2013-03-07 20:38 forevermemory 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles.Write a program to count 阅读全文
posted @ 2013-03-07 19:59 forevermemory 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionA friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessboard exactly once. He thinks that the most difficult part of the problem is determi 阅读全文
posted @ 2013-03-06 23:26 forevermemory 阅读(192) 评论(0) 推荐(0) 编辑
摘要: DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-negative integer is defined in the normal way: a^0 = " 阅读全文
posted @ 2013-03-04 15:56 forevermemory 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionIgnatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatius want to translate the history book into English. Can you help him?InputThe problem 阅读全文
posted @ 2013-02-26 14:25 forevermemory 阅读(177) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.You are to find all the hat’s words in a dictionary.InputStandard input consists of a number of lowercase words, one per line, in alphabetical order. There will be no mo 阅读全文
posted @ 2013-02-25 21:43 forevermemory 阅读(203) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串.注意:本题只有一组测试数据,处理到文件结束.Output对于每个提问,给出以该字符串为前缀的单词的数量.Sample Inputbanana band bee absolute 阅读全文
posted @ 2013-02-25 11:25 forevermemory 阅读(142) 评论(0) 推荐(0) 编辑
摘要: #include "WinSock.h"#include <iostream>using namespace std;#pragma comment(lib, "ws2_32.lib")int main(){char*ip;char name[32];WSADATA wsaData;WORD sv = MAKEWORD(2, 0);WSAStartup(sv, &wsaData);PHOSTENT hostname;gethostname (name, sizeof(name));hostname = gethostbyname(na 阅读全文
posted @ 2012-12-23 22:51 forevermemory 阅读(339) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionYou are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring of any of the given strings.InputThe first line of the input file contains a single integer t (1 <= t <= 10), 阅读全文
posted @ 2012-12-13 23:01 forevermemory 阅读(177) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionYou are given a string input. You are to find the longest substring of input such that the reversal of the substring is also a substring of input. In case of a tie, return the string that occurs earliest in input.Note well: The substring and its reversal may overlap partially or c 阅读全文
posted @ 2012-12-13 22:43 forevermemory 阅读(165) 评论(0) 推荐(0) 编辑