自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

qinglys的博客

努力成长的未来码农。

  • 博客(42)
  • 收藏
  • 关注

原创 编程思想--筛素数

//素数筛求素数

2017-09-12 19:53:46 331

原创 ACM课程总结

绪论 一学期的ACM课程终于结束了,还记得当初ACM新生赛自己轻轻松松拿了个一等奖,寒假的几次比赛也让我觉得难度不是很大,自然而然觉得所谓的ACM也不过如此,于是信心满满地选了这门课。直到上了几次课把基础的地方学完开始进阶的时候,瞬间感受到什么叫一脸懵逼……于是一学期的ACM课几乎都是懵着过来的。 一学期的课程让我学到了很多知识,认识了很多很厉害的大神,同时也意识到了自己很多的不足。在

2017-06-18 22:53:38 436

原创 二分贪心-D

原题 Description The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d =

2017-06-16 19:08:58 218

原创 二分贪心-B

原题 Description You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand t

2017-06-16 18:59:49 232

原创 搜索-T

原题 Description Background Mr 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 Problem

2017-06-16 17:40:45 313

原创 搜索-Q

原题 Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.

2017-06-16 17:37:06 251

原创 搜索-P

原题 Description 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 g

2017-06-16 17:33:00 276

原创 搜索-O

原题 Description Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest contest ever. I

2017-06-13 21:11:59 183

原创 搜索-I

原题 Description The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.

2017-06-13 21:08:27 268

原创 搜索-H

原题 Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater

2017-06-13 21:05:05 284

原创 搜索-G

原题 Description Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a poi

2017-06-13 21:02:01 290

原创 搜索-F

原题 Description Technicians in a pathology lab analyze digitized images of slides. Objects on a slide are selected for analysis by a mouse click on the object. The perimeter of the boundary of an o

2017-06-13 20:55:45 351

原创 搜索-D

原题 Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩

2017-06-13 20:48:21 240

原创 搜索-B

原题 Description Background The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves,

2017-05-15 21:13:54 193

原创 《递归递推练习》N - 青蛙过河

原题 Description 1)一条小溪尺寸不大,青蛙可以从左岸跳到右岸,在左岸有一石柱L,石柱L面积只容得下一只青蛙落脚,同样右岸也有一石柱R,石柱R面积也只容得下一只青蛙落脚。 2)有一队青蛙从小到大编号:1,2,…,n。 3)初始时:青蛙只能趴在左岸的石头 L 上,按编号一个落一个,小的落在大的上面—–不允许大的在小的上面。 4)在小溪中有S个石柱、有y片荷叶。 5)规定:溪中的每

2017-04-05 21:50:30 268

原创 《递归递推练习》M - 数值分解

原题 Description 对一个自然数N ( 1 <= N <= 50 ) ,N可以分解成若干个数字(数字可以是1,2,3,….,9)之和,问题是如何分解能使这些数字的乘积最大。 Input 输入数据有多组,每组占一行,每行包含一个自然数N(1 <= N <= 50)。输入文件直到EOF为止! Output 对每组输入,输出有2行。第一行是N分解出的所有数字,以

2017-04-05 21:40:13 211

原创 《递归递推练习》K - 们--加强斐波那契

原题 Description 对于斐波那契数列想必各位已经见过了。这里给出一个加强版。 F[i] = i (i <= 3); F[i] = F[i-1] + F[i-2] + F[i-3](i >= 4); Input 多组输入。每组输入一个整数n (1<= n && n <= 30)。 Output 每组数据输出一个整数,代表F[n]。思路 预处理,

2017-03-31 18:44:28 236

原创 《递归递推练习》J - 数学黑洞

原题 Description 任意一个4位自然数N(N不能是4个数字一样,如1111、2222、….9999是不可以的,N也不能是6174),将组成自然数N的4个数字重新排列,形成一个最大数和最小数,最大数和最小数相减,其差还是自然数,将差的各数字再重新排列,又形成一个最大数和最小数,最大数和最小数相减,其差还是自然数。反复进行,直到差是一个神秘数6174(数学黑洞)结束。 In

2017-03-31 18:40:48 200

原创 《递归递推练习》I - 蟠桃记

原题 Description 孙悟空在大闹蟠桃园的时候,第一天吃掉了所有桃子总数一半多一个,第二天又将剩下的桃子吃掉一半多一个,以后每天吃掉前一天剩下的一半多一个,到第n天准备吃的时候只剩下一个桃子。这下可把神仙们心疼坏了,请帮忙计算一下,第一天开始吃的时候一共有多少个桃子? Input 输入数据有多组,每组占一行,包含一个正整数n(1≤n≤30),表示只剩下一个桃子的时候是在

2017-03-31 18:18:14 590

原创 《递归递推练习》H - 三国佚事——巴蜀之危

原题 Description 话说天下大势,分久必合,合久必分。。。却道那魏蜀吴三国鼎力之时,多少英雄豪杰以热血谱写那千古之绝唱。古人诚不我欺,确是应了那句“一将功成万骨枯”。 是夜,明月高悬。诸葛丞相轻摇羽扇,一脸愁苦。原来是日前蜀国战事吃紧,丞相彻夜未眠,奋笔急书,于每个烽火台写下安排书信。可想,这战事多变,丞相运筹 帷幄,给诸多烽火台定下不同计策,却也实属不易。 谁成想

2017-03-31 17:44:19 246

原创 《递归递推练习》G - Fighting_小银考呀考不过四级

原题 Description 四级考试已经过去好几个星期了,但是小银还是对自己的英语水平担心不已。 小银打算好好学习英语,争取下次四级考试和小学弟小学妹一起拿下它! 四级考试的时候,监考老师会按考号分配固定的座位,但唯一不变的是每两个人之间肯定至少会留下两个空座位,原因相信大家都懂得。 那么问题来了,我们现在只关注教室里的一排座位,假设每排有n个座位,小银想知道这一排至少

2017-03-31 17:22:13 236

原创 《递归递推练习》F - 计算组合数

原题 Description 计算组合数。C(n,m),表示从n个数中选择m个的组合数。 计算公式如下: 若:m=0,C(n,m)=1 否则, 若 n=1,C(n,m)=1 否则,若m=n,C(n,m)=1 否则 C(n,m) = C(n-1,m-1) + C(n-1,m). Input

2017-03-31 17:17:12 608

原创 《递归递推练习》E - 养兔子

原题 Description 一对成熟的兔子每天能且只能产下一对小兔子,每次都生一公一母,每只小兔子的成熟期是1天,小兔子出生后隔一天才能再生小兔子。第一天某人领养了一对成熟的兔子,一公一母,请问第N天以后,他将会得到多少对兔子。 Input 测试数据包括多组,每组一行,为整数n(1≤n≤90)。 输入以0结束。 Output 对应输出第n天有几对兔子

2017-03-31 17:13:04 347

原创 《递归第推练习》D - 汉诺塔系列1

原题 Description n个盘子的汉诺塔问题的最少移动次数是2^n-1,即在移动过程中会产生2^n个系列。由于发生错移产生的系列就增加了,这种错误是放错了柱子,并不会把大盘放到小盘上,即各柱子从下往上的大小仍保持如下关系: n=m+p+q a1>a2>…>am b1>b2>…>bp c1>c2>…>cq 计算所有会产生的系列总数。 Input

2017-03-31 17:05:02 203

原创 《递归递推练习》C - 递归的函数

原题 Description 给定一个函数 f(a, b, c): 如果 a ≤ 0 或 b ≤ 0 或 c ≤ 0 返回值为 1; 如果 a > 20 或 b > 20 或 c > 20 返回值为 f(20, 20, 20); 如果 a < b 并且 b < c 返回 f(a, b, c−1) + f(a, b−1, c−1) − f(a, b−1, c); 其它

2017-03-31 16:56:07 340

原创 《递归递推练习》B - 王小二切饼

原题 Description 王小二自夸刀工不错,有人放一张大的煎饼在砧板上,问他:“饼不许离开砧板,切n(1<=n<=100)刀最多能分成多少块?” Input 输入切的刀数n。 Output 输出为切n刀最多切的饼的块数。思路 递推: 1:2 2:4 3:7 4:11 即:第N刀有(n*(n+1))/2+1块。AC代码#include<bits/

2017-03-31 16:50:47 997

原创 《递归递推练习》 A - 母牛的故事

原题 Description 有一对夫妇买了一头母牛,它从第2年起每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛? Input 输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0< n< 55),n的含义如题目中描述。 n=0表示输入数据的结束,不做处理。 Output 对于

2017-03-31 16:45:24 320

原创 《ACM书中题目》 W

原题 Description Tom’s Meadow Tom has a meadow in his garden. He divides it into N * M squares. Initially all the squares were covered with grass. He mowed down the grass on some of the square

2017-03-21 10:35:26 190

原创 《ACM书中题目》 V

原题 Description Jim is fond of reading books, and he has so many books that sometimes it’s hard for him to manage them. So he is asking for your help to solve this problem. Only interest in th

2017-03-21 10:25:42 236

原创 《ACM书中题目》 B

原题 Description We all know that FatMouse doesn’t speak English. But now he has to be prepared since our nation will join WTO soon. Thanks to Turing we have computers to help him. Input Specif

2017-03-21 10:18:25 161

原创 《ACM书中题目》 U

原题 Description Mike is very lucky, as he has two beautiful numbers, 3 and 5. But he is so greedy that he wants infinite beautiful numbers. So he declares that any positive number which is dividabl

2017-03-20 21:39:42 349

原创 《ACM书中题目》O

原题 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 contest is

2017-03-20 21:25:45 206

原创 《ACM书中题目》Z

原题 Description When a Little White meets another Little White: Little White A: (Surprised) ! Little White B: ? Little White A: You Little White know “SHDC”? So unbelieva

2017-03-20 21:10:40 415

原创 《ACM书中题目》Y

原题 Description The look and say sequence is defined as follows. Start with any string of digits as the first element in the sequence. Each subsequent element is defined from the previous on

2017-03-20 20:58:54 305

原创 《ACM书中题目》X

原题 Description Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers: Em

2017-03-20 20:42:02 210

原创 《ACM书中题目》T

原题 Given positive integers B and N, find an integer A such that AN is as close as possible to B. (The result A is an approximation to the Nth root of B.) Note that AN may be less than, equal to,

2017-03-20 18:52:32 196

原创 《ACM 书中题目》 N

题目 The Antique Comedians of Malidinesia prefer comedies to tragedies. Unfortunately, most of the ancient plays are tragedies. Therefore the dramatic advisor of ACM has decided to transfigure som

2017-03-18 16:44:20 391

原创 《ACM 书中题目》 M

题目 As part of an arithmetic competency program, your students will be given randomly generated lists of from 2 to 15 unique positive integers and asked to determine how many items in each list a

2017-03-18 16:33:05 218

原创 《ACM 书中题目》L

题目 In most languages, text is written from left to right. However, there are other languages where text is read and written from right to left. As a first step towards a program that automatical

2017-03-18 16:24:49 193

原创 《ACM 书中题目》 k

题目 Little Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. Look, I've built a wall!'', he tells his older sister Alice.Nah, yo

2017-03-18 16:14:47 209

空空如也

空空如也

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

TA关注的人

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