- 博客(66)
- 收藏
- 关注
原创 uva437 巴比伦塔
AC Code#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string>#include <string.h>#include <algorithm>#include <math.h>#include &l
2018-03-29 21:02:25
310
原创 uva10976
AC Code#include<stdio.h> #include<math.h> using namespace std; int main() { int k,x,y; while(scanf("%d",&k)!=EOF) { int sum=0; for(int y=k...
2018-03-26 20:41:29
374
原创 hdu1253 胜利大逃亡
Description Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个...
2018-03-25 23:32:07
298
原创 POJ1573 Robot Motion
Description A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructio...
2018-03-25 21:44:39
225
原创 poj2446 Chessboard
Description Alice and Bob often play games on chessboard. One day, Alice draws a board with size M * N. She wants Bob to use a lot of cards with size 1 * 2 to cover the board. However, ...
2018-03-25 20:42:49
267
原创 hdu3790 最短路径问题
Description 给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。 Input 输入n,m,点的编号是1~n,然后是m行,每...
2018-03-25 19:23:23
284
原创 hdu3615 Cow Hurdles
Description Farmer John wants the cows to prepare for the county jumping competition, so Bessie and the gang are practicing jumping over hurdles. They are getting tired, though, so they...
2018-03-24 21:01:00
301
原创 hdu1301 Jungle Roads
Description The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle ove...
2018-03-24 20:24:42
296
原创 hdu1863 畅通工程
Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。 ...
2018-03-24 13:07:15
190
原创 hdu1251 统计难题
Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input 输入数据的第一部分是一...
2018-03-24 11:26:59
191
原创 hdu1541 Stars
Description Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the sta...
2018-03-24 10:03:20
238
原创 算法训练 P1103 复数
编程实现两个复数的运算。设有两个复数 和 ,则他们的运算公式为: 要求:(1)定义一个结构体类型来描述复数。 (2)复数之间的加法、减法、乘法和除法分别用不用的函数来实现。 (3)必须使用结构体指针的方法把函数的计算结果返回。 说明:用户输入:运算符号(+,-,*,/) a b c d. 输出:a+bi,输出时不管a,b是小于0或等于0都按该格式输出,输出时a,b都保留两位。输入: -...
2018-03-21 16:27:46
420
原创 算法训练 字串统计 kmp
问题描述 给定一个长度为n的字符串S,还有一个数字L,统计长度大于等于L的出现次数最多的子串(不同的出现可以相交),如果有多个,输出最长的,如果仍然有多个,输出第一次出现最早的。输入格式 第一行一个数字L。 第二行是字符串S。 L大于0,且不超过S的长度。输出格式 一行,题目要求的字符串。 输入样例1: 4 bbaabbaaaaa 输出样例1: bbaa 输入样例2: 2 ...
2018-03-20 21:34:59
481
原创 hdu1800 Flying to the Mars
Description In the year 8888, the Earth is ruled by the PPF Empire . As the population growing , PPF needs to find more land for the newborns . Finally , PPF decides to attack Kscinow ...
2018-03-18 20:19:53
253
原创 hdu2689 Sort it
Description You want to processe a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. Then how many times it nee...
2018-03-18 17:35:02
269
原创 hdu1556 Color the ball
Description N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗? ...
2018-03-18 17:14:12
371
原创 hdu1166 敌兵布阵
Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过...
2018-03-18 16:47:02
171
原创 hdu1398 Square Coins
Description People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), ...
2018-03-18 13:07:14
386
原创 hdu1004 Let the Balloon Rise
Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the con...
2018-03-17 15:27:01
202
原创 poj3461 Oulipo
Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book:Tout avait ...
2018-03-17 13:59:17
161
原创 poj2752 Seek the Name, Seek the Fame
Description The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, a...
2018-03-17 12:58:53
177
原创 快速幂
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string>#include <string.h>#include <algorithm>#include <math.h>#include <limit
2018-03-16 21:01:41
163
原创 高精度乘法
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string>#include <string.h>#include <algorithm>#include <math.h>#include <limits.h&
2018-03-16 20:13:07
215
原创 高精度减法
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string>#include <string.h>#include <algorithm>#include <math.h>#include <limit
2018-03-16 19:47:41
309
原创 hdu1002 A + B Problem II
Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. Input ...
2018-03-16 19:12:26
177
原创 poj2562 Primary Arithmetic
Description Children are taught to add multi-digit numbers from right-to-left one digit at a time. Many find the "carry" operation - in which a 1 is carried from one digit position to b...
2018-03-16 13:22:38
302
原创 poj1423 Big Number
Description In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem yo...
2018-03-16 13:04:18
287
原创 poj2828 Buy Tickets
Description Railway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the...
2018-03-16 12:07:24
194
原创 poj1144 Network
Description A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N . No two places have the sa...
2018-03-15 21:31:38
200
原创 连号区间数
问题描述小明这些天一直在思考这样一个奇怪而有趣的问题:在1~N的某个全排列中有多少个连号区间呢?这里所说的连号区间的定义是:如果区间[L, R] 里的所有元素(即此排列的第L个到第R个元素)递增排序后能得到一个长度为R-L+1的“连续”数列,则称这个区间连号区间。当N很小的时候,小明可以很快地算出答案,但是当N变大的时候,问题就不是那么简单了,现在小明需要你的帮助。输入格式第一行是一个正整数N (...
2018-03-14 20:01:40
185
原创 poj3259 Wormholes
Description While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its d...
2018-03-14 18:21:17
202
原创 poj1751 Highways
Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem and has...
2018-03-14 17:00:24
259
原创 poj3624 Charm Bracelet
Description Bessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available c...
2018-03-13 17:56:23
199
原创 poj1700 Crossing River
Description A group of N people wishes to go across a river with only one boat, which can at most carry two persons. Therefore some sort of shuttle arrangement must be arranged in order...
2018-03-13 16:59:01
189
转载 poj1664 放苹果
Description 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。 Input 第一行是测试数据的数目t(0 <= t <= ...
2018-03-13 16:04:25
152
原创 hdu1874 畅通工程续
Description 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 ...
2018-03-13 14:30:01
225
原创 hdu1233 还是畅通工程
Description 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 ...
2018-03-13 14:02:58
147
原创 poj1469 COURSES
Description Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of...
2018-03-12 17:43:46
198
原创 poj1258 Agri-Net
Description Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course. Farm...
2018-03-12 17:25:25
238
原创 poj1502 MPI Maelstrom
Description BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Vale...
2018-03-12 16:57:05
393
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人