上一页 1 ··· 31 32 33 34 35
Problem IAutomatic Poetry Input: standard inputOutput: standard outputTime Limit: 2 secondsMemory Limit: 32 MB“Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!”In Tomb Raider XIV, Lara is, as ever, gunning her way through ancient Egyptian pyramids, prehistoric caves and medival h Read More
posted @ 2012-06-16 14:40 godjob Views(325) Comments(0) Diggs(0)
Q10010: Where's Waldorf?給你一個m*n的字元方塊(1 <= m,n <=50),以及一些字串,請你找出這些字串在字元方塊中出現的位置。請參考Sample Output。我們在字元方塊中尋找字串的方向可以有8個:往左、往右、往上、往下、往左上、往左下、往右上、往右下。另外,請忽略字元大小寫,即 A 和 a 應被視為相同的字元。Input輸入的第一列有一個整數代表以下有幾組測試資料。每組測試資料的第1列,有2個整數m,n(1 <= m,n <=50),代表接下來的文字方塊有m列,每列有n個字元。在文字方塊之後的一列有一個整數 k,代表接下來的 Read More
posted @ 2012-06-15 23:55 godjob Views(387) Comments(0) Diggs(0)
PalindromesA regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when the string is read from left to right as when the string is read from right to left. A mirrored string is Read More
posted @ 2012-06-15 18:06 godjob Views(238) Comments(0) Diggs(0)
A*寻路初探(转载)作者:Patrick Lester译者:Panic2005年译者序:很久以前就知道了A*算法,但是从未认真读过相关的文章,也没有看过代码,只是脑子里有个模糊的概念。这次决定从头开始,研究一下这个被人推崇备至的简单方法,作为学习人工智能的开始。这篇文章非常知名,国内应该有不少人翻译过它,我没有查找,觉得翻译本身也是对自身英文水平的锻炼。经过努力,终于完成了文档,也明白的A*算法的原理。毫无疑问,作者用形象的描述,简洁诙谐的语言由浅入深的讲述了这一神奇的算法,相信每个读过的人都会对此有所认识(如果没有,那就是偶的翻译太差了--b)。现在是年月日的版本,应原作者要求,对文中的某些 Read More
posted @ 2012-06-08 17:16 godjob Views(243) Comments(0) Diggs(1)
Q489: Hangman JudgeHangman Judge是一個猜英文單字的小遊戲(在電子字典中常會看到),遊戲規則如下: 答案單字寫在紙上(每個字元一張紙),並且被蓋起來,玩家每次猜一個英文字元(letter)。 如果這個英文字元猜中(在答案的英文單字中有出現),被猜中的字元就被翻開。例如:答案是book,如果你猜o,book中的兩個o就會被視為已猜中。 如果這個英文字元未出現在答案的單字中,就會在hangman的圖中多加一劃。要完成hangman圖共需7劃,如下圖。注意:同一個猜錯的字元只能再圖上畫一劃,例如:答案是book,第一次你猜a(未猜中)會在圖上畫一劃,但第二次... Read More
posted @ 2012-06-03 22:51 godjob Views(359) Comments(0) Diggs(0)
Q445: Marvelous Mazes本題中你的任務是寫一支可以畫迷宮的程式,這個迷宮將由A-Z26個字母及*(星號)和空白字元組成。Input and Output你的程式必須從input讀入迷宮的資訊,輸入將包含數列字元,你的程式必須依照指示畫出迷宮。迷宮的每一列都會藉由一系列的數字和字元來表達,數字代表這個字元被使用多少次。如果數字超過一位數則這個字元重複出現的次數為每一位數相加的總合。在input中小寫的"b"代表空白字元,驚嘆號(!)以及換行都代表結束一列。迷宮的列數並沒有限制,但是每一列不會超過132個字元。Sample Input1T1b5T!1T2b1T Read More
posted @ 2012-06-03 21:31 godjob Views(275) Comments(0) Diggs(0)
Q490: Rotating Sentences在這個問題中你必須將數列文字往順時針方向旋轉90度。也就是說將原本由左到右,由上到下的句子輸出成由上到下,由右到左。Input and Output輸入最多不會超過100列,每列最多不會超過100個字元。 合法的字元包括:換行,空白,所有的標點符號,數字,以及大小寫字母。(注意:Tabs並不算是合法字元。)最後一列輸入必須垂直輸出在最左邊一行,輸入的第一列必須垂直輸出在最右邊一行。請參考sample intput/output。Sample InputRene Decartes once said,"I thin... Read More
posted @ 2012-06-03 16:45 godjob Views(383) Comments(0) Diggs(0)
Kindergarten Counting GameEverybody sit down in a circle. Ok. Listen to me carefully.``Woooooo, you scwewy wabbit!''Now, could someone tell me how many words I just said?Input and OutputInput to your program will consist of a series of lines, each line containing multiple words (at least one Read More
posted @ 2012-06-03 16:41 godjob Views(359) Comments(0) Diggs(0)
3*x^4+6*x^3+2*x^2+5*x+6求值的过程为33*x + 63*x^2 +6*x+23*x^3 +6*x^2+2*x+53*x^4 +6*x^3+2*x^2+5*x+6#include <iostream>#include <stdlib.h>#include <stdio.h>using namespace std;int main(){ printf("多项式求值的Horner算法n"); printf("n说明:对于求多项式3*x^4+6*x^3+2*x^2+5*x+6当x=2 时的值,应该按以下输入n&qu Read More
posted @ 2012-06-03 14:48 godjob Views(1050) Comments(0) Diggs(0)
在网上看到的一个比较好的The 3n+1 problem,通过中间变量来保存结果集,较少了运算数量 1 #include <iostream> 2 3 #include <vector> 4 5 6 7 #define SIZE 100000 8 9 10 11 using namespace std;12 13 14 15 int Count(vector<int> &viRec, int iNum)16 17 {18 19 int iTemp=iNum, iResult=0;20 21 22 23 if (viRec[iTemp]!=0) ret Read More
posted @ 2012-06-03 14:43 godjob Views(224) Comments(0) Diggs(0)
上一页 1 ··· 31 32 33 34 35