自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 快乐写递归

#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std ;//N皇后问题(递归)int N ;int queen[100] ;void Queen(int n) //摆放第n-1行的皇后{ if(n==N) { for(int i = 0 ; i < N ; i ++)

2021-03-12 22:56:35 121

原创 1015 德才论 (25 分)

德才论宋代史学家司马光在《资治通鉴》中有一段著名的“德才论”:“是故才德全尽谓之圣人,才德兼亡谓之愚人,德胜才谓之君子,才胜德谓之小人。凡取人之术,苟不得圣人,君子而与之,与其得小人,不若得愚人。”现给出一批考生的德才分数,请根据司马光的理论给出录取排名。输入格式:输入第一行给出 3 个正整数,分别为:N(≤10​5​​ ),即考生总数;L(≥60),为录取最低分数线,即德分和才分均不低于 L 的考生才有资格被考虑录取;H(<100),为优先录取线——德分和才分均不低于此线的被定义为“才德

2021-02-27 15:15:21 81

原创 Knights of a Polygonal Table

Knights of a Polygonal TableUnlike Knights of a Round Table, Knights of a Polygonal Table deprived of nobility and happy to kill each other. But each knight has some power and a knight can kill another knight if and only if his power is greater than the p

2021-02-19 20:00:33 103

原创 Strange Birthday Party

Strange Birthday PartyPetya organized a strange birthday party. He invited n friends and assigned an integer ki to the i-th of them. Now Petya would like to give a present to each of them. In the nearby shop there are m unique presents available, the j-th

2021-02-19 19:54:21 118

原创 Heaters

HeatersVova’s house is an array consisting of n elements (yeah, this is the first problem, I think, where someone lives in the array). There are heaters in some positions of the array. The i-th element of the array is 1 if there is a heater in the positio

2021-02-19 19:51:50 86

原创 Lawnmower(除草)

LawnmowerYou have a garden consisting entirely of grass and weeds. Your garden is described by an n × m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (r, c) which means that th

2021-02-19 19:49:21 406

原创 New Year Book Reading

New Year Book ReadingNew Year is coming, and Jaehyun decided to read many books during 2015, unlike this year. He has n books numbered by integers from 1 to n. The weight of the i-th (1 ≤ i ≤ n) book is wi.As Jaehyun’s house is not large enough to have a

2021-02-19 19:42:53 71

原创 序列(贪心)

序列有一个整数序列,它的每个数各不相同,我们不知道它的长度是多少(即整数个数),但我们知道在某些区间中间至少有多少个整数,用 (Li,Ri,Ci) 来描述,表示这个整数序列中至少有 Ci个数来自区间 [Li,Ri],给出若干个这样的区间,问这个整数序列的长度最少能为多少?输入格式第一行一个整数 N(1≤N≤1000),表示区间个数;接下来 N 行,每行三个整数,描述一个区间和区间内数至少有 Ci 个。输出格式一个数,表示该整数序列的最小长度。Sample Input44 5 16 10 3

2021-02-19 19:29:54 283

原创 Clique Problem

Clique ProblemThe clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vertices C of the maximum size such that any

2021-02-19 19:23:37 288

原创 Make It Equal(贪心加前缀和)

Make It EqualThere is a toy building consisting of n towers. Each tower consists of several cubes standing on each other. The i-th tower consists of hi cubes, so it has height hi.Let’s define operation slice on some height H as following: for each tower

2021-02-19 19:12:53 249

原创 Bound Found

Bound FoundSignals of most probably extra-terrestrial origin have been received and digitalized by The Aeronautic and Space Administration (that must be going through a defiant phase: “But I want to use feet, not meters!”). Each signal seems to come in tw

2021-02-10 09:20:23 119

原创 Subsequence

SubsequenceA sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the subsequence of consecutive elements of

2021-02-10 09:15:00 101

原创 数字三角形

###动态规划eg:数字三角形给定一个如下图所示的数字三角形,从顶部出发,在每一结点可以选择移动至其左下方的结点或移动至其右下方的结点,一直走到底层,要求找出一条路径,使路径上的数字的和最大。 7 3 8 8 1 0 2 7 4 44 5 2 6 5输入格式第一行包含整数n,表示数字三角形的层数。接下来n行,每行包含若干整数,其中第 i 行表示数字三角形第 i 层包含的整数。输出格式输出一个整数,表示最大的路径

2021-02-10 09:09:04 73

原创 string

stringThere is a string S.S only contain lower case English character.(10≤length(S)≤1,000,000)How many substrings there are that contain at least k(1≤k≤26) distinct characters?InputThere are multiple test cases. The first line of input contains an inte

2021-02-10 09:03:35 61

原创 Stressful Training

** Stressful Training**Berland SU holds yet another training contest for its students today. n students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers!Let students be numbered from 1 to n. Laptop of

2021-02-08 01:59:27 136

原创 Magic Ship

Magic ShipYou a captain of a ship. Initially you are standing in a point (x1,y1) (obviously, all positions in the sea can be described by cartesian plane) and you want to travel to a point (x2,y2).You know the weather forecast — the string s of length n,

2021-02-08 01:54:43 128

原创 Can you solve this equation?

Can you solve this equation?Now,given the equation 8x^4 + 7x^3 + 2x^2 + 3x + 6 == Y,can you find its solution between 0 and 100;Now please try your lucky.InputThe first line of the input contains an integer T(1<=T<=100) which means the number of

2021-02-08 01:38:47 76

原创 Monthly Expense

Monthly ExpenseFarmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤ moneyi ≤ 10,000) that he will need to spend each day over the n

2021-02-08 01:33:06 81

原创 一元三次方程求解

一元三次方程求解有 一个一元三次方程。给出该方程中各项的系数(a , b , c ,d 均为实数),并约定该方程存在三个不同实根(根的范围−100至 100之间),且根与根之差的绝对值 ≥1。要求由小到大依次在同一行输出这三个实根(根与根之间留有空格),并精确到小数点后 2位。输入格式一行,4 个实数 A,B,C,D。输出格式一行,3个实根,并精确到小数点后2位。Sample Input1 -5 -4 20Sample Output-2.00 2.00 5.00对方称求导后算出

2021-02-08 01:23:02 308

原创 Number of Ways

Number of WaysYou’ve got array a[1], a[2], …, a[n], consisting of n integers. Count the number of ways to split all the elements of the array into three contiguous parts so that the sum of elements in each part is the same.More formally, you need to find

2021-02-07 02:29:05 171

原创 Segment Occurrences

Segment OccurrencesYou are given two strings s and t, both consisting only of lowercase Latin letters.The substring s[l…r] is the string which is obtained by taking characters sl,sl+1,…,sr without changing the order.Each of the occurrences of string a i

2021-02-07 02:21:37 145

原创 前缀极差

前缀极差蒜头君有 n 个数,他提出了 q 个问题,每个问题是说,询问前 x 个数的极差(最大值减最小值)。你能帮助他解决这 q 个问题吗?输入格式第一行两个整数 n,q(1≤n,q≤105)第二行 n个整数 ai(1≤ai≤109)表示蒜头君的 n个数第三行 q个整数 xi(1≤xi≤n),表示每一次询问输出格式输出一行,包含 q个整数,表示每一次询问的答案数据范围对于 60%的数据, 1≤n,q≤103对于 100%的数据,1≤n,q≤105Sample Input5 53 2 4

2021-02-07 02:15:37 1153 4

原创 Pie

Pie翔翔今天过生日,他很高兴,买了N个半径不一定相同的蛋糕给他的F个朋友吃,当然他自己也要吃,公平起见,每个人吃到的蛋糕的体积应该是一样的。已知蛋糕的高都是 1,请问每个人能吃到的最大的蛋糕的体积是多少 ?(注意:每个人的蛋糕都应该是一整块的,不能由多个小块组成,当然也可以是一整个蛋糕)Input第一行输入一个T代表组数。随后T组的第一行包含两个正整数N和F,1 ≤ N, F ≤ 10000和N个1到10000之间的整数,表示蛋糕的数量,朋友的数量。第二行分别表示每个蛋糕的半径。Output

2021-02-05 16:19:23 173

原创 切绳子

有 n条绳子,它们的长度分别为 Li,如果从它们中切割出 m 长度相同的绳子,这 m条绳子每条最长能有多长?输入格式第一行两个整数 n和 m。接下来 n行,每行一个实数,描述了每条绳子的长度 Li 。数据范围:1≤n≤m≤104,1≤Li≤105。输出格式切割后每条绳子的最大长度,答案向下保留到小数点后 2位。Sample Input4 118.027.434.575.39Sample Output2.00二分,但这个题超级坑,WA了五次,精度要求超高,所以最后改的思路就是

2021-02-05 16:17:12 502

原创 最大的和

最大的和给定一个包含整数的二维矩阵,子矩形是位于整个阵列内的任何大小为1 * 1或更大的连续子阵列。矩形的总和是该矩形中所有元素的总和。在这个问题中,具有最大和的子矩形被称为最大子矩形。例如,下列数组:0 -2 -7 09 2 -6 2-4 1 -4 1-1 8 0 -2其最大子矩形为:9 2-4 1-1 8它拥有最大和15。输入格式输入中将包含一个N*N的整数数组。第一行只输入一个整数N,表示方形二维数组的大小。从第二行开始,输入由空格和换行符隔开的N2个整数,它们即为二

2021-01-31 17:05:26 188

原创 Photo of The Sky

Photo of The SkyPavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordi

2021-01-26 15:11:57 104

原创 滑雪场设计

滑雪场设计农夫约翰的农场上有 N 个山丘,每座山的高度都是整数。在冬天,约翰经常在这些山上举办滑雪训练营。不幸的是,从明年开始,国家将实行一个关于滑雪场的新税法。如果滑雪场的最高峰与最低峰的高度差大于17,国家就要收税。为了避免纳税,约翰决定对这些山峰的高度进行修整。已知,增加或减少一座山峰 x 单位的高度,需要花费 x2 的金钱。约翰只愿意改变整数单位的高度。请问,约翰最少需要花费多少钱,才能够使得最高峰与最低峰的高度差不大于17。输入格式第一行包含整数 N。接下来 N 行,每行包含

2021-01-26 15:11:45 171

原创 奖牌数

Beautiful Regional ContestSo the Beautiful Regional Contest (BeRC) has come to an end! n students took part in the contest. The final standings are already known: the participant in the i-th place solved pi problems. Since the participants are primarily s

2021-01-26 15:11:31 272

原创 Pairs

PairsToad Ivan has m pairs of integers, each integer is between 1 and n, inclusive. The pairs are (a1,b1),(a2,b2),…,(am,bm).He asks you to check if there exist two integers x and y (1≤x<y≤n) such that in each given pair at least one integer is equal t

2021-01-26 15:11:17 117

原创 多边形角度

Polygon for the AngleYou are given an angle ang.The Jury asks You to find such regular n-gon (regular polygon with n vertices) that it has three vertices a, b and c (they can be non-consecutive) with ∠abc=ang or report that there is no such n-gon.If the

2021-01-26 15:11:07 372

原创 Make a Square

Make a SquareYou are given a positive integer n, written without leading zeroes (for example, the number 04 is incorrect).In one operation you can delete any digit of the given integer so that the result remains a positive integer without leading zeros.

2021-01-26 15:10:55 516

空空如也

空空如也

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

TA关注的人

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