自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 约瑟夫环

N个人围成一圈顺序编号,从1号开始按1、2、3…顺序报数,报p者退出圈外,其余的人再从1、2、3开始报数,报p的人再退出圈外,以此类推。 请按退出顺序输出每个退出人的原序号。输入格式:输入只有一行,包括一个整数N(1<=N<=3000)及一个整数p(1<=p<=5000)。输出格式:按退出顺序输出每个退出人的原序号,数据间以一个空格分隔,但行尾无空格。输入样例:7 3输出样例:3 6 2 7 5 1 4#include<iostream>#includ

2021-03-29 21:45:10 109 1

原创 动态规划1

骨牌铺方格在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数.例如n=3时,为2× 3方格,骨牌的铺放方案有三种,如下图:Input输入数据由多行组成,每行包含一个整数n,表示该测试实例的长方形方格的规格是2×n (0<n<=50)。Output对于每个测试实例,请输出铺放方案的总数,每个实例的输出占一行。Sample Input132Sample Output132 递推#include<iostream&gt

2021-03-04 00:23:00 170 1

原创 Oil Deposits 油藏

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 the land into numerous square plots. It then analyzes each

2021-02-09 16:19:58 307

原创 Way Too Long Words 单词太长了

Sometimes some words like “localization” or “internationalization” are so long that writing them many times in one text is quite tiresome.Let’s consider a word too long, if its length is strictly more than 10 characters. All too long words should be repla

2021-02-09 16:08:05 425

原创 Watermelon西瓜

One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w kilos. They rushed home, dying of thirst, and decided to d

2021-02-09 16:00:43 586

原创 Gennady and a Card Game Gennady和纸牌游戏

Gennady owns a small hotel in the countryside where he lives a peaceful life. He loves to take long walks, watch sunsets and play cards with tourists staying in his hotel. His favorite game is called “Mau-Mau”.To play Mau-Mau, you need a pack of 52 cards.

2021-02-09 15:50:43 133

原创 作弊揭发者

鉴于我市拥堵的交通状况,市政交管部门经过听证决定在道路两侧安置自动停车收费系统。当车辆驶入车位,系统会通过配有的摄像头拍摄车辆画面,通过识别车牌上的数字、字母序列识别车牌,通过连接车管所车辆信息数据库确认车辆,进行扣费。斗智斗勇的好戏一般从此处展开…一些车主通过在停车时遮挡车牌上的一个或多个数字、字母序列,来阻碍识别系统的识别工作,以此逃避停车费用的缴纳。车主这简直是用轻轻的一挡搞出来一个世界难题有木有?!管理是一方面,技术解决才是王道啊。这么难的项目不得不交给计蒜客实验室了。D 神负责识别颜色,E

2020-12-07 21:14:50 146

原创 纪念品分组

元旦快到了,校学生会让乐乐负责新年晚会的纪念品发放工作。为使得参加晚会的同学所获得 的纪念品价值相对均衡,他要把购来的纪念品根据价格进行分组,但每组最多只能包括两件纪念品, 并且每组纪念品的价格之和不能超过一个给定的整数。为了保证在尽量短的时间内发完所有纪念品,乐乐希望分组的数目最少。你的任务是写一个程序,找出所有分组方案中分组数最少的一种,输出最少的分组数目。输入格式第 1行包括一个整数 w,为每组纪念品价格之和的上限。第 2行为一个整数 n,表示购来的纪念品的总件数。第 3∼n+2 行每行包含一

2020-12-07 21:11:23 97

原创 Yet Another Two Integers Problem

You are given two integers a and b.In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k∈[1;10] and perform a:=a+k or a:=a−k. You may use different values of k in different m

2020-12-07 15:20:29 129

原创 Decrease the Sum of Digits 减少位数之和

You are given a positive integer n. In one move, you can increase n by one (i.e. make n:=n+1). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of n be less than or equal to s.You have to answer t ind

2020-12-07 14:45:43 181

原创 最长回文子串

输入一个字符串Str,输出Str里最长回文子串的长度。回文串:指aba、abba、cccbccc、aaaa这种左右对称的字符串。串的子串:一个串的子串指此(字符)串中连续的一部分字符构成的子(字符)串例如 abc 这个串的子串:空串、a、b、c、ab、bc、abcInput输入Str(Str的长度 <= 1000)Output输出最长回文子串的长度L。Sample InputdaabaacSample Output5Sample InputabcSample Output

2020-11-22 15:06:01 255

原创 O - Three Friends

Three friends are going to meet each other. Initially, the first friend stays at the position x=a, the second friend stays at the position x=b and the third friend stays at the position x=c on the coordinate axis Ox.In one minute each friend independently

2020-11-01 14:54:37 159

原创 Prefixes

Nikolay got a string s of even length n, which consists only of lowercase Latin letters ‘a’ and ‘b’. Its positions are numbered from 1 to n.He wants to modify his string so that every its prefix of even length has an equal amount of letters ‘a’ and ‘b’. T

2020-11-01 14:31:19 134

原创 Symmetric Order

In your job at Albatross Circus Management (yes, it’s run by a bunch of clowns), you have just finished writing a program whose output is a list of names in nondescending order by length (so that each name is at least as long as the one preceding it). Howe

2020-11-01 14:23:35 197

原创 E - 和为给定数

蒜头君给出若干个整数,询问其中是否有一对数的和等于给定的数。输入格式共三行:第一行是整数 n(0<n≤100,000),表示有n个整数。第二行是 n个整数。整数的范围是在 0到 2×10⁸之间。第三行是一个整数 m(0≤m≤2³⁰),表示需要得到的和。输出格式若存在和为 m 的数对,输出两个整数,小的在前,大的在后,中间用单个空格隔开。若有多个数对满足条件,选择数对中较小的数更小的。若找不到符合要求的数对,输出一行"No"。Sample Input42 5 1 46Sample

2020-10-26 21:25:37 226

原创 G - 蚂蚁

n只蚂蚁以每秒1cm的速度在长为Lcm的竿子上爬行。当蚂蚁爬到竿子的端点时就会掉落。由于竿子太细,两只蚂蚁相遇时,它们不能交错通过,只能各自反向爬回去。对于每只蚂蚁,我们知道它距离竿子左端的距离xi,但不知道它当前的朝向。请计算各种情况当中,所有蚂蚁落下竿子所需的最短时间和最长时间。例如:竿子长10cm,3只蚂蚁位置为2 6 7,最短需要4秒(左、右、右),最长需要8秒(右、右、右)。Input第1行:2个整数N和L,N为蚂蚁的数量,L为杆子的长度(1 <= L <= 10^9, 1 &

2020-10-25 19:12:43 88

原创 L - Tricky Alchemy棘手的炼金术

During the winter holidays, the demand for Christmas balls is exceptionally high. Since it’s already 2018, the advances in alchemy allow easy and efficient ball creation by utilizing magic crystals.Grisha needs to obtain some yellow, green and blue balls.

2020-10-25 18:41:09 145

空空如也

空空如也

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

TA关注的人

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