OpenJudge/Poj 1915 Knight Moves
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1915http://poj.org/problem?id=19152.题目:总Time Limit:1000msMemory Limit:65536kBDescriptionBackgroundMr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from one position to another so fast. Can you beat him?The Proble
阅读全文
posted @
2014-02-28 21:00
mobileliker
阅读(299)
推荐(0)
OpenJudge 2757 最长上升子序列 / Poj 2533 Longest Ordered Subsequence
摘要:1.链接地址:http://poj.org/problem?id=2533http://bailian.openjudge.cn/practice/27572.题目:总Time Limit:2000msMemory Limit:65536kBDescription一个数的序列bi,当b1 2 #include 3 4 using namespace std; 5 6 int main() 7 { 8 //freopen("C://input.txt","r",stdin); 9 10 int n;//1 > n;12 13 int i,j;14 1
阅读全文
posted @
2014-02-28 20:52
mobileliker
阅读(397)
推荐(0)
OpenJudge/Poj 1163 The Triangle
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1163http://poj.org/problem?id=11632.题目:总时间限制:1000ms内存限制:65536kB描述73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top an...
阅读全文
posted @
2014-02-27 21:39
mobileliker
阅读(233)
推荐(0)
OpenJudge/Poj 1844 Sum
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1844http://poj.org/problem?id=18442.题目:SumTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 10031Accepted: 6564DescriptionConsider the natural numbers from 1 to N. By associating to each number a sign (+ or -) and calculating the value of this expre
阅读全文
posted @
2014-02-27 21:30
mobileliker
阅读(202)
推荐(0)
OpenJudge/Poj 1321 棋盘问题
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1321http://poj.org/problem?id=13212.题目:棋盘问题Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 20403Accepted: 10138Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行
阅读全文
posted @
2014-02-27 21:23
mobileliker
阅读(389)
推荐(0)
OpenJudge/Poj 1753 Flip Game
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1753/http://poj.org/problem?id=17532.题目:总时间限制:1000ms内存限制:65536kB描述Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying eith
阅读全文
posted @
2014-02-27 03:14
mobileliker
阅读(456)
推荐(0)
OpenJudge/Poj 1191 棋盘分割
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1191/http://poj.org/problem?id=11912.题目:总时间限制:1000ms内存限制:65536kB描述将一个8*8的棋盘进行如下分割:将原棋盘割下一块矩形棋盘并使剩下部分也是矩形,再将剩下的部分继续如此分割,这样割了(n-1)次后,连同最后剩下的矩形棋盘共有n块矩形棋盘。(每次切割都只能沿着棋盘格子的边进行)原棋盘上每一格有一个分值,一块矩形棋盘的总分为其所含各格分值之和。现在需要把棋盘按上述规则分割成n块矩形棋盘,并使各矩形棋盘总分的均方差最小。均方差,其中平均值,xi为第i
阅读全文
posted @
2014-02-27 03:07
mobileliker
阅读(457)
推荐(0)
OpenJudge/Poj 1723 SOLDIERS
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1723/http://poj.org/problem?id=17232.题目:总时间限制:1000ms内存限制:65536kB描述N soldiers of the land Gridland are randomly scattered around the country. A position in Gridland is given by a pair (x,y) of integer coordinates. Soldiers can move - in one move, one soldie
阅读全文
posted @
2014-02-27 00:14
mobileliker
阅读(273)
推荐(0)
OpenJudge 2803 碎纸机 / Poj 1416 Shredding Company
摘要:1.链接地址:http://poj.org/problem?id=1416http://bailian.openjudge.cn/practice/28032.题目:总时间限制:1000ms内存限制:65536kB描述你现在负责设计一种新式的碎纸机。一般的碎纸机会把纸切成小片,变得难以阅读。而你设计的新式的碎纸机有以下的特点:1.每次切割之前,先要给定碎纸机一个目标数,而且在每张被送入碎纸机的纸片上也需要包含一个数。2.碎纸机切出的每个纸片上都包括一个数。3.要求切出的每个纸片上的数的和要不大于目标数而且与目标数最接近。举一个例子,如下图,假设目标数是50,输入纸片上的数是12346。碎纸机会
阅读全文
posted @
2014-02-27 00:07
mobileliker
阅读(779)
推荐(0)
模板:函数memcpy
摘要:函数原型void *memcpy(void *dest, const void *src, size_t n);2功能从源src所指的内存地址的起始位置开始拷贝n个字节到目标dest所指的内存地址的起始位置中3所需头文件C语言中使用#include ;C++中使用#include 和#include 都可以。前者只是为了凸显C++风格。4返回值函数返回指向dest的指针。5说明1.source和destin所指的内存区域可以重叠,但是如果source和destin所指的内存区域重叠,那么这个函数并不能够确保source所在重叠区域在拷贝之前被覆盖。而使用memmove可以用来处理重叠区域。函数
阅读全文
posted @
2014-02-25 00:23
mobileliker
阅读(268)
推荐(0)
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
阅读(1329)
推荐(0)
模板:优先队列(priority_queue)
摘要:1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 struct node 9 {10 int priortity;11 int value;12 13 friend bool operator 从小到大16 }17 };18 19 int main()20 {21 const int len = 5;22 int i;23 int a[len] = {3,5,9,6,2};24 25 //example 1:26 ...
阅读全文
posted @
2014-02-24 21:13
mobileliker
阅读(346)
推荐(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
阅读(222)
推荐(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
阅读(213)
推荐(0)
模板:使用文件作为输入
摘要:1 freopen("C://input.txt","r",stdin);
阅读全文
posted @
2014-02-20 22:09
mobileliker
阅读(137)
推荐(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
阅读(742)
推荐(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
阅读(285)
推荐(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
阅读(402)
推荐(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)
模板:LCS(最长公共子序列)
摘要:1 #include 2 3 #define max(a,b) ((a) > (b) ? (a) : (b)) 4 5 int same(char ch1,char ch2) 6 { 7 if(ch1 == ch2) return 1; 8 else return 0; 9 ...
阅读全文
posted @
2014-02-17 00:22
mobileliker
阅读(190)
推荐(0)
OpenJudge/Poj 1159 Palindrome
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1159/http://poj.org/problem?id=11592.题目:PalindromeTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 49849Accepted: 17153DescriptionA palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to l
阅读全文
posted @
2014-02-17 00:19
mobileliker
阅读(215)
推荐(0)
OpenJudge/Poj 1207 The 3n + 1 problem
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1207/http://poj.org/problem?id=12072.题目:总时间限制:1000ms内存限制:65536kB描述Problems 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 algori
阅读全文
posted @
2014-02-15 22:14
mobileliker
阅读(264)
推荐(0)
OpenJudge/Poj 1005 I Think I Need a Houseboat
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1005/http://poj.org/problem?id=10052.题目:I Think I Need a HouseboatTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 82376Accepted: 35628DescriptionFred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of
阅读全文
posted @
2014-02-15 22:03
mobileliker
阅读(331)
推荐(0)
OpenJudge/Poj 1163 The Triangle
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1163http://poj.org/problem?id=11632.题目:总时间限制:1000ms内存限制:65536kB描述73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top an...
阅读全文
posted @
2014-02-14 16:58
mobileliker
阅读(215)
推荐(0)
Openjudge/Poj 1183 反正切函数的应用
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1183http://poj.org/problem?id=11832.题目:总时间限制:1000ms内存限制:65536kB描述反正切函数可展开成无穷级数,有如下公式(其中0 ab+ac=bc-1令b=a+m,c=a+n==>mn=a^2+1所以m或n必然小于a,且为正整数所以可以直接枚举m的值了,注意计算a*a可能爆longint4.代码: 1 #include 2 #include 3 4 using namespace std; 5 6 int main() 7 { 8 long l...
阅读全文
posted @
2014-02-14 16:49
mobileliker
阅读(419)
推荐(0)
OpenJudge 2813 画家问题 / Poj 1681 Painter's Problem
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2813http://poj.org/problem?id=16812.题目:总时间限制:1000ms内存限制:65536kB描述有一个正方形的墙,由N*N个正方形的砖组成,其中一些砖是白色的,另外一些砖是黄色的...
阅读全文
posted @
2014-02-14 16:38
mobileliker
阅读(1010)
推荐(0)
OpenJudge 2747 数字方格
摘要:1.链接地址:http://bailian.openjudge.cn/practice/27472.题目:总时间限制:1000ms内存限制:65536kB描述如上图,有3个方格,每个方格里面都有一个整数a1,a2,a3。已知0 2 3 using namespace std; 4 5 int main() 6 { 7 int t; 8 cin>>t; 9 10 int n;11 int a1,a2,a3;12 int k1,k2;13 while(t--)14 {15 int max = 0;16 c...
阅读全文
posted @
2014-02-14 16:32
mobileliker
阅读(701)
推荐(0)
模板:qsort+bsearch应用
摘要:(1)qsort:功 能: 使用快速排序例程进行排序头文件:stdlib.h用 法: void qsort(void *base,int nelem,int width,int (*fcmp)(const void *,const void *));参数: 1 待排序数组首地址2 数组中待排序元素数...
阅读全文
posted @
2014-02-14 01:12
mobileliker
阅读(301)
推荐(0)
OpenJudge/Poj 1125 Stockbroker Grapevine
摘要:1.链接地址:http://poj.org/problem?id=1125http://bailian.openjudge.cn/practice/11252.题目:Stockbroker GrapevineTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 24810Accepted: 13674DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading di
阅读全文
posted @
2014-02-14 01:06
mobileliker
阅读(261)
推荐(0)
Poj 1054 The Troublesome Frog / OpenJudge 2812 恼人的青蛙
摘要:1.链接地址:http://poj.org/problem?id=1054http://bailian.openjudge.cn/practice/28122.题目:总时间限制:10000ms内存限制:65536kB描述在韩国,有一种小的青蛙。每到晚上,这种青蛙会跳越稻田,从而踩踏稻子。农民在早上看到被踩踏的稻子,希望找到造成最大损害的那只青蛙经过的路径。每只青蛙总是沿着一条直线跳越稻田,而且每次跳跃的距离都相同。如下图所示,稻田里的稻子组成一个栅格,每棵稻子位于一个格点上。而青蛙总是从稻田的一侧跳进稻田,然后沿着某条直线穿越稻田,从另一侧跳出去如下图所示,可能会有多只青蛙从稻田穿越。青蛙的每
阅读全文
posted @
2014-02-14 00:57
mobileliker
阅读(687)
推荐(0)
模板:高精度整数比较大小
摘要:1 #include 2 3 int cmp(string str1,string str2) 4 { 5 if(str1.size() != str2.size()) return str1.size() - str2.size(); 6 int i; 7 for(i...
阅读全文
posted @
2014-02-14 00:53
mobileliker
阅读(518)
推荐(0)
OpenJudge 2739 计算对数
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2739/2.题目:总时间限制:1000ms内存限制:65536kB描述给定两个正整数a和b。可以知道一定存在整数x,使得x 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 string mul(string str1,string str2)10 {11 vector v_res(str1.size()+str2.size(),0);12 string::size_type i,...
阅读全文
posted @
2014-02-14 00:52
mobileliker
阅读(703)
推荐(0)
OpenJudge 2753 菲波那契数列
摘要:1.链接地址:http://bailian.openjudge.cn/practice/27532.题目:总时间限制:1000ms内存限制:65536kB描述菲波那契数列是指这样的数列: 数列的第一个和第二个数都为1,接下来每个数都等于前面2个数之和。给出一个正整数a,要求菲波那契数列中第a个数是多少。输入第1行是测试数据的组数n,后面跟着n行输入。每组测试数据占1行,包括一个正整数a(1 2 3 using namespace std; 4 5 int f(int a) 6 { 7 if(a == 1 || a == 2) return 1; 8 else return...
阅读全文
posted @
2014-02-13 17:53
mobileliker
阅读(493)
推荐(0)
OpenJudge 2756 二叉树
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2756/2.题目:总时间限制:1000ms内存限制:65536kB描述如上图所示,由正整数1, 2, 3, ...组成了一棵无限大的二叉树。从某一个结点到根结点(编号是1的结点)都有一条唯一的路径,比如从10到根结点的路径是(10, 5, 2, 1),从4到根结点的路径是(4, 2, 1),从根结点1到根结点的路径上只包含一个结点1,因此路径就是(1)。对于两个结点x和y,假设他们到根结点的路径分别是(x1, x2, ... ,1)和(y1, y2, ... ,1)(这里显然有x = x1,y = y1)
阅读全文
posted @
2014-02-13 17:52
mobileliker
阅读(280)
推荐(0)
Poj/OpenJudge 1094 Sorting It All Out
摘要:1.链接地址:http://poj.org/problem?id=1094http://bailian.openjudge.cn/practice/10942.题目:Sorting It All OutTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 25547Accepted: 8861DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to ord
阅读全文
posted @
2014-02-13 15:47
mobileliker
阅读(281)
推荐(0)
OpenJudge 2811 熄灯问题 / Poj 1222 EXTENDED LIGHTS OUT
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2811http://poj.org/problem?id=12222.题目:总时间限制:1000ms内存限制:65536kB描述有一个由按钮组成的矩阵,其中每行有6个按钮,共5行。每个按钮的位置上有一盏灯。当按下一个按钮后,该按钮以及周围位置(上边、下边、左 边、右边)的灯都会改变一次。即,如果灯原来是点亮的,就会被熄灭;如果灯原来是熄灭的,则会被点亮。在矩阵角上的按钮改变3盏灯的状态;在矩阵边上的按 钮改变4盏灯的状态;其他的按钮改变5盏灯的状态。在上图中,左边矩阵中用X标记的按钮表示被按下,右边的矩阵
阅读全文
posted @
2014-02-13 15:28
mobileliker
阅读(755)
推荐(0)
OpenJudge/Poj 1083 Moving Tables
摘要:1.链接地址:http://poj.org/problem?id=1083http://bailian.openjudge.cn/practice/1083/2.题目:总时间限制:1000ms内存限制:65536kB描述The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south ...
阅读全文
posted @
2014-02-12 22:11
mobileliker
阅读(309)
推荐(0)
OpenJudge 2810(1543) 完美立方 / Poj 1543 Perfect Cubes
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2810/http://bailian.openjudge.cn/practice/1543/http://poj.org/problem?id=15432.题目:Perfect CubesTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 13190Accepted: 6995DescriptionFor hundreds of years Fermat's Last Theorem, which stated simply that
阅读全文
posted @
2014-02-12 22:03
mobileliker
阅读(342)
推荐(0)
Poj/OpenJudge 1042 Gone Fishing
摘要:1.链接地址:http://bailian.openjudge.cn/practice/1042/http://poj.org/problem?id=10422.题目:Gone FishingTime Limit: 2000MSMemory Limit: 32768KTotal Submissions: 27652Accepted: 8199DescriptionJohn is going on a fishing trip. He has h hours available (1 = 0 ), is known. Each 5 minutes of fishing decreases the
阅读全文
posted @
2014-02-12 21:22
mobileliker
阅读(297)
推荐(0)
Poj 1013 Counterfeit Dollar / OpenJudge 1013(2692) 假币问题
摘要:1.链接地址:http://poj.org/problem?id=1013http://bailian.openjudge.cn/practice/2692http://bailian.openjudge.cn/practice/10132.题目:Counterfeit DollarTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 37454Accepted: 11980DescriptionSally Jones has a dozen Voyageur silver dollars. However, only eleven
阅读全文
posted @
2014-02-12 21:15
mobileliker
阅读(435)
推荐(0)
Poj 1017 / OpenJudge 1017 Packets/装箱问题
摘要:1.链接地址:http://poj.org/problem?id=1017http://bailian.openjudge.cn/practice/10172.题目:总时间限制:1000ms内存限制:65536kB描述一个工厂制造的产品形状都是长方体,它们的高度都是h,长和宽都相等,一共有六个型号,他们的长宽分别为1*1, 2*2, 3*3, 4*4, 5*5, 6*6。这些产品通常使用一个 6*6*h 的长方体包裹包装然后邮寄给客户。因为邮费很贵,所以工厂要想方设法的减小每个订单运送时的包裹数量。他们很需要有一个好的程序帮他们解决这个问题从而节 省费用。现在这个程序由你来设计。输入输入文件包
阅读全文
posted @
2014-02-12 20:08
mobileliker
阅读(367)
推荐(0)
模板:高精度浮点数相乘
摘要:1 #include 2 #include 3 #include 4 5 string mul(string str1,string str2) 6 { 7 vector v_res(str1.size()+str2.size(),0); 8 string::size_ty...
阅读全文
posted @
2014-02-12 19:56
mobileliker
阅读(280)
推荐(0)
Poj 1001 / OpenJudge 2951 Exponentiation
摘要:1.链接地址:http://poj.org/problem?id=1001http://bailian.openjudge.cn/practice/29512.题目:ExponentiationTime Limit: 500MSMemory Limit: 10000KTotal Submissions: 127573Accepted: 31149DescriptionProblems involving the computation of exact values of very large magnitude and precision are common. For example, t
阅读全文
posted @
2014-02-12 19:55
mobileliker
阅读(320)
推荐(0)
Poj 1006 / OpenJudge 2977 1006 Biorhythms/生理周期
摘要:1.链接地址:http://poj.org/problem?id=1006http://bailian.openjudge.cn/practice/29772.题目:BiorhythmsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: ...
阅读全文
posted @
2014-02-12 19:46
mobileliker
阅读(315)
推荐(0)
OpenJudge/Poj 1004 Financial Management
摘要:1.链接地址:http://poj.org/problem?id=1004http://bailian.openjudge.cn/practice/10042.题目:总时间限制:1000ms内存限制:65536kB描述Larry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfoli
阅读全文
posted @
2014-02-11 16:58
mobileliker
阅读(267)
推荐(0)
模板:浮点数加法
摘要:1 #include 2 #include 3 4 string sum(string s1,string s2) 5 { 6 if(s1.length()=0;i--,j--)14 {15 s1[i]=char(s1[i]+(j>=0?s2[j]-'0':0...
阅读全文
posted @
2014-02-11 16:48
mobileliker
阅读(214)
推荐(0)
OpenJudge 2738 浮点数加法
摘要:1.链接地址:http://bailian.openjudge.cn/practice/27382.题目:总时间限制:1000ms内存限制:65536kB描述求2个浮点数相加的和题目中输入输出中出现浮点数都有如下的形式:P1P2...Pi.Q1Q2...Qj对于整数部分,P1P2...Pi是一个非负整数对于小数部分,Qj不等于0输入第1行是测试数据的组数n,每组测试数据占2行,分别是两个加数。每组测试数据之间有一个空行,每行数据不超过100个字符输出n行,每组测试数据有一行输出是相应的和。输出保证一定是一个小数部分不为0的浮点数样例输入20.11111111111111111111111111
阅读全文
posted @
2014-02-11 16:47
mobileliker
阅读(617)
推荐(0)
OpenJudge 2809 计算2的N次方
摘要:1.链接地址:http://bailian.openjudge.cn/practice/2809/2.题目:总时间限制:1000ms内存限制:65536kB描述任意给定一个正整数N(N 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 string mul(string str1,string str2)10 {11 vector v_res(str1.size()+str2.size(),0);12 string::size_type i,j;13 vector...
阅读全文
posted @
2014-02-11 16:42
mobileliker
阅读(2154)
推荐(0)