OpenJudge/Poj 1658 Eva's Problem
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1658http://poj.org/problem?id=16582.题目:总时间限制:1000ms内存限制:65536kB描述Eva的家庭作业里有很多数列填空练习。填空练习的要求是:已知数列的前四项,填出第五项。因为已经知道这些数列只可能是等差或等比数列,她决定写一个程序来完成这些练习。输入第一行是数列的数目t(0 <= t <= 20)。以下每行均包含四个整数,表示数列的前四项。约定数列的前五项均为不大于10^5的自然数,等比数列的比值也是自然数。输出对输入的每个数列,输出它的前五项。样例
阅读全文
posted @
2014-02-25 00:14
mobileliker
阅读(299)
推荐(0)
OpenJudge 2802 小游戏 / Poj 1101 The Game
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2802http://poj.org/problem?id=11012.题目:总时间限制:1000ms内存限制:65536kB描述一天早上,你起床的时候想:“我编程序这么牛,为什么不能靠这个赚点小钱呢?”因此你决定编写一个小游戏。游戏在一个分割成w * h个正方格子的矩形板上进行。如图所示,每个正方格子上可以有一张游戏卡片,当然也可以没有。当下面的情况满足时,我们认为两个游戏卡片之间有一条路径相连:路径只包含水平或者竖直的直线段。路径不能穿过别的游戏卡片。但是允许路径临时的离开矩形板。下面是一个例子: 这里
阅读全文
posted @
2014-02-25 00:06
mobileliker
阅读(1326)
推荐(0)
OpenJudge/Poj 1657 Distance on Chessboard
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1657http://poj.org/problem?id=16572.题目:总时间限制:1000ms内存限制:65536kB描述国际象棋的棋盘是黑白相间的8 * 8的方格,棋子放在格子中间。如下图所示:王、后、车、象的走子规则如下:王:横、直、斜都可以走,但每步限走一格。后:横、直、斜都可以走,每步格数不受限制。车:横、竖均可以走,不能斜走,格数不限。象:只能斜走,格数不限。写一个程序,给定起始位置和目标位置,计算王、后、车、象从起始位置走到目标位置所需的最少步数。输入第一行是测试数据的组数t(0 2 .
阅读全文
posted @
2014-02-23 22:57
mobileliker
阅读(221)
推荐(0)
OpenJudge 2775 文件结构“图”/ Poj 1057 FILE MAPPING
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2775http://poj.org/problem?id=10572.题目:总时间限制:1000ms内存限制:65536kB描述在计算机上看到文件系统的结构通常很有用。Microsoft Windows上面的"explorer"程序就是这样的一个例子。但是在有图形界面之前,没有图形化的表示方法的,那时候最好的方式是把目录和文件的结 构显示成一个"图"的样子,而且使用缩排的形式来表示目录的结构。比如:ROOT| dir1| | file1| | file2| ...
阅读全文
posted @
2014-02-23 22:48
mobileliker
阅读(1386)
推荐(0)
OpenJudge 2787 算24
摘要:1.链接地址:http://poj.org/problem?id=1631http://bailian.openjudge.cn/practice/2787/2.题目:总时间限制:3000ms内存限制:65536kB描述给出4个小于10个正整数,你可以使用加减乘除4种运算以及括号把这4个数连接起来得到一个表达式。现在的问题是,是否存在一种方式使得得到的表达式的结果等于24。这里加减乘除以及括号的运算结果和运算的优先级跟我们平常的定义一致(这里的除法定义是实数除法)。比如,对于5,5,5,1,我们知道5 * (5 – 1 / 5) = 24,因此可以得到24。又比如,对于1,1,4,2,我们怎么
阅读全文
posted @
2014-02-21 23:31
mobileliker
阅读(620)
推荐(0)
OpenJudge/Poj 1631 Bridging signals
摘要:1.链接地址:http://poj.org/problem?id=1631http://bailian.openjudge.cn/practice/16312.题目:Bridging signalsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 9882Accepted: 5409Description'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the r
阅读全文
posted @
2014-02-21 23:29
mobileliker
阅读(212)
推荐(0)
OpenJudge/Poj 1517 u Calculate e
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1517http://poj.org/problem?id=15172.题目:总时间限制:1000ms内存限制:65536kB描述A simple mathematical formula for e is e=Σ0<=i<=n1/i!where n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.输
阅读全文
posted @
2014-02-20 22:06
mobileliker
阅读(326)
推荐(0)
OpenJudge 2790 迷宫
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2790/2.题目:总时间限制:3000ms内存限制:65536kB描述一天Extense在森林里探险的时候不小心走入了一个迷宫,迷宫可以看成是由n * n的格点组成,每个格点只有2种状态,.和#,前者表示可以通行后者表示不能通行。同时当Extense处在某个格点时,他只能移动到东南西北(或者说上 下左右)四个方向之一的相邻格点上,Extense想要从点A走到点B,问在不走出迷宫的情况下能不能办到。如果起点或者终点有一个不能通行(为#),则 看成无法办到。输入第1行是测试数据的组数k,后面跟着k组输入。每组
阅读全文
posted @
2014-02-20 21:58
mobileliker
阅读(741)
推荐(0)
OpenJudge 2749 分解因数
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2749/2.题目:总时间限制:1000ms内存限制:65536kB描述给出一个正整数a,要求分解成若干个正整数的乘积,即a = a1 * a2 * a3 * ... * an,并且1 2 #include 3 4 using namespace std; 5 6 int f(int s,int a) 7 { 8 int i; 9 int res = 1;10 for(i = s; i * i > n;23 24 int a;25 while(n--)26 ...
阅读全文
posted @
2014-02-20 21:55
mobileliker
阅读(684)
推荐(0)
OpenJudge 2815 城堡问题 / Poj 1164 The Castle
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2815/http://poj.org/problem?id=11642.题目:总时间限制:1000ms内存限制:65536kB描述 1 2 3 4 5 6 7 ############################# 1 # | # | # | | # #####---#####---#---#####---# 2 # # | # # # # # #---#####---#####---#####--...
阅读全文
posted @
2014-02-20 21:50
mobileliker
阅读(646)
推荐(0)
OpenJudge 2817:木棒 / Poj 1011 Sticks
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2817/http://poj.org/problem?id=10112.题目:总时间限制:1000ms内存限制:65536kB描述乔治拿来一组等长的木棒,将它们随机地裁断,使得每一节木棍的长度都不超过50个长度单位。然后他又想把这些木棍恢复到为裁截前的状态,但忘 记了初始时有多少木棒以及木棒的初始长度。请你设计一个程序,帮助乔治计算木棒的可能最小长度。每一节木棍的长度都用大于零的整数表示。输入输入包含多组数据,每组数据包括两行。第一行是一个不超过64的整数,表示砍断之后共有多少节木棍。第二行是截断以后,所
阅读全文
posted @
2014-02-20 21:37
mobileliker
阅读(539)
推荐(0)
OpenJudge 2754 八皇后
摘要:1.链接地址:http://bailian.openjudge.cn/practice/27542.题目:总时间限制:1000ms内存限制:65536kB描述会下国际象棋的人都很清楚:皇后可以在横、竖、斜线上不限步数地吃掉其他棋子。如何将8个皇后放在棋盘上(有8 * 8个方格),使它们谁也不能被吃掉!这就是著名的八皇后问题。 对于某个满足要求的8皇后的摆放方法,定义一个皇后串a与之对应,即a=b1b2...b8,其中bi为相应摆法中第i行皇后所处的列数。已经知道8皇后问题一共有92组解(即92个不同的皇后串)。给出一个数b,要求输出第b个串。串的比较是这样的:皇后串x置于皇后串y之前,当且仅当
阅读全文
posted @
2014-02-19 23:49
mobileliker
阅读(284)
推荐(0)
Poj 1503 Integer Inquiry
摘要:1.链接地址:http://poj.org/problem?id=15032.题目:Integer InquiryTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 28115Accepted: 10925DescriptionOne of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored takin
阅读全文
posted @
2014-02-19 23:47
mobileliker
阅读(177)
推荐(0)
OpenJudge/Poj 1979 Red and Black / OpenJudge 2816 红与黑
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1979http://poj.org/problem?id=19792.题目:总时间限制:1000ms内存限制:65536kB描述There 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. Bu
阅读全文
posted @
2014-02-18 22:24
mobileliker
阅读(312)
推荐(0)
OpenJudge/Poj 1664 放苹果
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1664http://poj.org/problem?id=16642.题目:总时间限制:1000ms内存限制:65536kB描述把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。输入第一行是测试数据的数目t(0 2 #include 3 4 using namespace std; 5 6 int f(int m,int n) 7 { 8 if(n == 1 || m == 0) return 1; 9 ...
阅读全文
posted @
2014-02-18 22:22
mobileliker
阅读(270)
推荐(0)
OpenJudge/Poj 1316 Self Numbers
摘要:1.链接地址:http://poj.org/problem?id=1316http://bailian.openjudge.cn/practice/13162.题目:总时间限制:1000ms内存限制:65536kB描述In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d stand
阅读全文
posted @
2014-02-18 22:20
mobileliker
阅读(237)
推荐(0)
OpenJudge/Poj 1458 Common Subsequence
摘要:1.链接地址:http://poj.org/problem?id=1458http://bailian.openjudge.cn/practice/1458/2.题目:Common SubsequenceTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 35411Accepted: 14080DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a s
阅读全文
posted @
2014-02-18 22:18
mobileliker
阅读(244)
推荐(0)
OpenJudge/Poj 1251 丛林中的路/Jungle Roads
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1251/http://poj.org/problem?id=12512.题目:总时间限制:1000ms内存限制:65536kB描述 热带岛屿Lagrishan的首领现在面临一个问题:几年前,一批外援资金被用于维护村落之间的道路,但日益繁茂的丛林无情的侵蚀着村民的道路,导致道路维修开销巨大,长老会不得不放弃部分道路的维护。上图左侧图显示的是正在使用道路的简图以及每条路每个月的维修费用(单位为aacms)。现在长老会需要提出一种方案,即需要保证村落之间都可以互相到达,又要将每个月的道路维修费用控制在最小。村.
阅读全文
posted @
2014-02-17 22:48
mobileliker
阅读(555)
推荐(0)
OpenJudge 2694 逆波兰表达式
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2694/2.题目:总时间限制:1000ms内存限制:65536kB描述逆波兰表达式是一种把运算符前置的算术表达式,例如普通的表达式2 + 3的逆波兰表示法为+ 2 3。逆波兰表达式的优点是运算符之间不必有优先级关系,也不必用括号改变运算次序,例如(2 + 3) * 4的逆波兰表示法为* + 2 3 4。本题求解逆波兰表达式的值,其中运算符包括+ - * /四个。输入输入为一行,其中运算符和运算数之间都用空格分隔,运算数是浮点数。输出输出为一行,表达式的值。可直接用printf("%f\n&quo
阅读全文
posted @
2014-02-17 22:45
mobileliker
阅读(401)
推荐(0)
OpenJudge/Poj 1226 Substrings
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1226/http://poj.org/problem?id=12262.题目:总时间限制:1000ms内存限制:65536kB描述You 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 strin
阅读全文
posted @
2014-02-17 00:30
mobileliker
阅读(186)
推荐(0)