自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(46)
  • 收藏
  • 关注

原创 UVA 400 Unix ls

The computer company you work for is introducing a brand new computer line and is developing a new Unix-like operating system to be introduced along with the new computer. Your assignment is to write

2015-08-21 10:04:40 428

原创 UVA 136 Ugly Numbers

Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, ...shows the first 11 ugly numbers. By convention, 1 is included.Write a

2015-08-21 10:00:35 300

原创 UVA 540 Team Queue

Queues and Priority Queues are data structures which are known to most computer scientists. The Team Queue, however, is not so well known, though it occurs often in everyday life. At lunch time the

2015-08-21 09:58:34 294

原创 UVA 156 Ananagrams

Most crossword puzzle fans are used to anagrams--groups of words with the same letters in different orders--for example OPTS, SPOT, STOP, POTS and POST. Some words however do not have this attribute,

2015-08-21 09:55:42 356

原创 UVA 10815 Andy's First Dictionary

又开始贴不上题了 给你一段话,按字典序排序set  集合  元素唯一setset_name;stringstream ss(s);以空格和回车为分隔符依次解析s#include#include#include#include #include #includeusing namespace std; setsett;int main(){ int i

2015-08-21 09:51:30 365

原创 UVA 101 The Blocks Problem

Background Many areas of Computer Science use simple, abstract domains for both analytical and empirical studies. For example, an early AI study of planning and robotics (STRIPS) used a block world

2015-08-21 09:45:38 318

原创 UVA 10474 Where is the Marble?

Raju and Meena love to play with Marbles. They have got a lot ofmarbles with numbers written on them. At the beginning, Raju wouldplace the marbles one after another in ascending order of the numb

2015-08-21 09:39:41 312

原创 UVA 129 Krypton Factor

You have been employed by the organisers of a Super Krypton Factor Contest in which contestants have very high mental and physical abilities. In one section of the contest the contestants are tested o

2015-08-21 09:33:20 297

原创 UVA 524 Prime Ring Problem dfs

A ring is composed of n (even number) circles as shown in diagram. Put natural numbers  into each circle separately, and the sum of numbers in two adjacent circles should be a prime.Note: 

2015-08-21 09:30:56 289

原创 UVA 10976 Fractions Again?!

It is easy to see that for every fraction in the form 1k(k > 0), we can always find two positive integersx and y, x ≥ y, such that:1k=1x+1yNow our question is: can you write a p

2015-08-21 09:27:47 342

原创 UVA 11059 Maximum Product

Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of themaximum positive product involving consecutive terms of S. If you cannot find a positive sequence,

2015-08-21 09:24:28 385

原创 UVA 725 Division

Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits 0through 9 once each, such that the first number divided by the second is equal to an integer N,

2015-08-21 09:21:36 308

原创 HDU 1856 More is better 并查集

Problem DescriptionMr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of course there are certain requirements.

2015-08-20 17:07:53 296

原创 UVA 1644 Prime Gap

The sequence of n - 1 consecutive composite numbers (positive integers that are not prime and not equal to 1) lying between two successive prime numbers p and p + n is called a prime gap of length n

2015-08-20 17:05:15 335

原创 CodeForces 560B Gerald is into Art

Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the boa

2015-08-20 17:02:59 414

原创 CodeForces 550B Preparing Olympiad

You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemset for a contest, using some of the problems you've made.A problemset fo

2015-08-20 16:55:41 401

原创 UVA 11040 Add bricks in the wall

This in not “another brick in the wall”, it’s just a matter of adding numbers. Suppose you have a wallwith the shape of a triangle, like the one shown below. The wall has 9 rows and row i has exactl

2015-08-20 16:51:44 338

原创 CodeForces 560A Currency System in Geraldion

A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionian

2015-08-20 16:49:31 463

原创 UVA 1635 Irrelevant Elements

贴不上题目  直接上代码#include#include#includeusing namespace std;const int maxx=100007;int bad[maxx];void E(int m,vector &prime){ int k=m; for(int i=2;i*i<=m;i++) { if(m%i==0)

2015-08-20 16:46:51 274

原创 UVA 12716 GCD XOR

贴不上题目  直接上代码#include#includeusing namespace std;const int maxx=30000000;int A[maxx+7];void E(){ int b; for(int c=1;c>1);c++) { for(int a=c+c;a<=maxx;a+=c) {

2015-08-20 16:45:27 300

原创 UVA 10791 Minimum Sum LCM

贴不上题目  直接上代码#includeusing namespace std;int main(){ int t=0; long long n; while(cin>>n) { if(n==0) break; cout<<"Case "<<++t<<": "; long long

2015-08-20 16:44:14 308

原创 UVA 10375 Choose and divide

贴不上题目  直接上代码#include#includeusing namespace std;int p,q,r,s;int main(){ while(cin >> p >> q >> r >> s) { double pro=1.0; for(int i=1;;i++) { if

2015-08-20 16:05:34 270

原创 UVA 11582 - Colossal Fibonacci Numbers!

不知道怎么搞的  题目粘不上来了直接上代码吧#include #include #include #include #include #include using namespace std;int f[10010],n,mod;int gao(){ f[0]=0,f[1]=1%n; for(int i=2;;i++) {

2015-08-20 15:56:37 295

原创 UVA 10305 - Ordering Tasks

用DFS求出有向无环图(DAG)的拓扑排序John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task isonly possible if other tasks have already been executed.InputThe i

2015-08-20 15:49:06 374

原创 UVA 572 Oil Deposits dfs求连通块

The 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 th

2015-08-20 15:46:37 305

原创 UVA 679 Drop 完全二叉树

对于一个结点k,其左子结点、右子结点的编号分别是2k和2k+1A number of K balls are dropped one by one from the root of a fully binary tree structure FBT. Each time the ball being dropped first visits a non-terminal node. It

2015-08-20 15:42:57 295

原创 UVA 11988 Broken Keyboard (a.k.a. Beiju Text) 悲剧文本 链表

You’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problemwith the keyboard is that sometimes the “home” key or the “end” key gets automatically pressed(inte

2015-08-20 15:37:35 823

原创 UVA 514 Rails 栈

DescriptionThere is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. I

2015-08-20 15:32:52 341

原创 hdu 1711 整理下水题

Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] =

2015-06-15 21:42:33 347

原创 hdu 2602 整理下水题 背包

Problem DescriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grav

2015-06-15 21:39:08 832

原创 hdu 1159 整理下水题 递推动规

Problem DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there e

2015-06-15 21:37:13 273

原创 hdu 2084 整理下水题 递推动规

Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗? Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1

2015-06-15 21:34:38 300

原创 hdu 2569 整理下水题 递推动规

Problem Description突破蝙蝠的包围,yifenfei来到一处悬崖面前,悬崖彼岸就是前进的方向,好在现在的yifenfei已经学过御剑术,可御剑轻松飞过悬崖。现在的问题是:悬崖中间飞着很多红,黄,蓝三种颜色的珠子,假设我们把悬崖看成一条长度为n的线段,线段上的每一单位长度空间都可能飞过红,黄,蓝三种珠子,而yifenfei必定会在该空间上碰到一种颜色的珠子。如果在连续3

2015-06-15 21:33:18 534

原创 hdu 2041 整理下水题 递推动规

Problem Description有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法? Input输入数据首先包含一个整数N,表示测试实例的个数,然后是N行数据,每行包含一个整数M(1 Output对于每个测试实例,请输出不同走法的数量 Sample Input2

2015-06-15 21:29:29 267

原创 hdu 2013 整理下水题 递推动规

Problem Description喜欢西游记的同学肯定都知道悟空偷吃蟠桃的故事,你们一定都觉得这猴子太闹腾了,其实你们是有所不知:悟空是在研究一个数学问题!什么问题?他研究的问题是蟠桃一共有多少个!不过,到最后,他还是没能解决这个难题,呵呵^-^当时的情况是这样的:第一天悟空吃掉桃子总数一半多一个,第二天又将剩下的桃子吃掉一半多一个,以后每天吃掉前一天剩下的一半多一个,

2015-06-15 21:27:33 335

原创 hdu 1785 整理下水题 排序

Problem Description本次集训队共有30多人参加,毫无疑问,你们都是很优秀的,但是由于参赛名额有限,只能选拔部分队员参加省赛。从学校的角度,总是希望选拔出最优秀的18人组成6支队伍来代表学校。但是,大家也知道,要想做到完全客观,是一件很难的事情。因为选拔的标准本身就很难统一。为了解决这个难题,我现在把问题作了简化,现在假设每个队员都是二维平面中的一个点,用(xi,yi)

2015-06-15 21:21:58 425

原创 hdu 1425 整理下水题 排序

Problem Description给你n个整数,请按从大到小的顺序输出其中前m大的数。 Input每组测试数据有两行,第一行有两个数n,m(0<n,m<1000000),第二行包含n个各不相同,且都处于区间[-500000,500000]的整数。 Output对每组测试数据按从大到小的顺序输出前m大的数。 Sample Input5 33 -35 92 213 -644 Samp

2015-06-15 21:20:00 289

原创 hdu 2020 整理下水题 排序

Problem Description输入n(n Input输入数据有多组,每组占一行,每行的第一个数字为n,接着是n个整数,n=0表示输入数据的结束,不做处理。  Output对于每个测试实例,输出排序后的结果,两个数之间用一个空格隔开。每个测试实例占一行。 Sample Input3 3 -4 2

2015-06-15 21:16:47 369

原创 hdu 1106 整理下水题 排序

Problem Description输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若干个‘0’组成的,这时这个整数就是0)。你的任务是:对这些分割得到的整数,依从小到大的顺序排序输出。 Input输入包含多组测试用例,每组输

2015-06-15 21:13:44 331

原创 hdu 1022 整理下水题 栈和队列

Problem DescriptionAs the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is

2015-06-15 21:08:59 382

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除