自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Adventurer‘s Guild

链接:https://ac.nowcoder.com/acm/contest/15600/H题目描述Yuna traveled into the fantasy world. The gods of this world gave her a powerful set of equipment so that she could defeat many fierce monsters. However, she had limited health points and stamina, and s

2021-05-10 18:41:20 342

原创 L1-6 吉老师的回归

曾经在天梯赛大杀四方的吉老师决定回归天梯赛赛场啦!为了简化题目,我们不妨假设天梯赛的每道题目可以用一个不超过 500 的、只包括可打印符号的字符串描述出来,如:Problem A: Print "Hello world!"。众所周知,吉老师的竞赛水平非常高超,你可以认为他每道题目都会做(事实上也是……)。因此,吉老师会按照顺序看题并做题。但吉老师水平太高了,所以签到题他就懒得做了(浪费时间),具体来说,假如题目的字符串里有qiandao或者easy(区分大小写)的话,吉老师看完题目就会跳过这道...

2021-04-27 10:57:23 456

原创 What to Cook?

题目描述The renowned restaurant Gusteau’s has closed down, and now Remy is working at a new restaurant called Highly Sophisticated Parisian Cuisine (HSPC). However, business is busy, and Remy needs help determining whether he can cook the various dishes that

2021-04-13 21:32:31 161

原创 Racer Car Ranking(map排序)

题目描述Lightning McQueen, Strip Weathers, and Chick Hicks are cars that compete in different races against each other. Some races — such as the Piston Cup — are considered more prestigious than others, while others — such as Thunder Hollow — are somewhat le

2021-04-13 20:38:51 131

原创 Exam Manipulation

题目描述A group of students is taking a True/False exam. Each question is worth one point. You, as theirteacher, want to make your students look as good as possible—so you cheat! (I know, you wouldnever actually do that.) To cheat, you manipulate the answe..

2021-04-11 16:59:39 202

原创 结点选择 蓝桥杯

结点选择问题描述有一棵 n 个节点的树,树上每个节点都有一个正整数权值。如果一个点被选择了,那么在树上和它相邻的点都不能被选择。求选出的点的权值和最大是多少?输入格式第一行包含一个整数 n 。接下来的一行包含 n 个正整数,第 i 个正整数代表点 i 的权值。接下来一共 n-1 行,每行描述树上的一条边。输出格式输出一个整数,代表选出的点的权值和的最大值。样例输入51 2 3 4 51 21 32 42 5样例输出12样例说明选择3、4、5号

2021-03-04 11:49:59 169 1

原创 K好数 蓝桥杯

试题 算法训练 K好数问题描述如果一个自然数N的K进制表示中任意的相邻的两位都不是相邻的数字,那么我们就说这个数是K好数。求L位K进制数中K好数的数目。例如K = 4,L = 2的时候,所有K好数为11、13、20、22、30、31、33 共7个。由于这个数目很大,请你输出它对1000000007取模后的值。输入格式输入包含两个正整数,K和L。输出格式输出一个整数,表示答案对1000000007取模后的值。样例输入4 2样例输出7数据规模与约定对于30%.

2021-03-02 16:18:55 101

原创 Catch That Cow(广搜)

DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a pointN(0 ≤N≤ 100,000) on a number line and the cow is at a pointK(...

2019-12-01 09:23:34 118

原创 Largest Rectangle in a Histogram (单调栈)

A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows ...

2019-09-16 11:48:08 200

原创 最大的数

幼儿园里的小朋友十分爱思考,今天他们向你提出了这么一个问题 : 一个句子中最大的整数是多少。你很不幸的被这些小朋友们叫住了,而且还非常不幸的要帮助他们解决这个问题,你觉得十分不爽,因为你觉得如此简单的问题简直就是对你智商的一种侮辱,所以你决定写个程序给他们,这样他们就不用再来找你了,让程序来告诉他们答案吧。输入格式:输入一个句子(一定包含数字字符,可能包含空格),长度小于256,占一行...

2019-08-27 11:41:35 256

原创 Windows Of CCPC

Problem DescriptionIn recent years, CCPC has developed rapidly and gained a large number of competitors .One contestant designed a design called CCPC Windows .The 1-st order CCPC window is shown in ...

2019-08-24 14:50:14 397

原创 On-Screen Keyboard

题目描述You are to input a string with an OSK (on-screen keyboard). A remote control with five buttons, four arrows and an OK (Fig. B-1), is used for the OSK. Find the minimum number of button presses r...

2019-08-22 14:11:48 698

原创 Circular Sequence

Some DNA sequences exist in circular forms as in the following figure, which shows a circular sequence “CGAGTCAGCT”, that is, the last symbol “T” in “CGAGTCAGCT” is connected to the first symbol “C”. ...

2019-08-21 17:14:20 121

原创 Master-Mind Hints

MasterMind is a game for two players. One of them,Designer, selects a secret code. The other,Breaker, tries to break it. A code is no more than a row of colored dots. At the beginning of a game, the...

2019-08-21 16:24:15 208

原创 硬币购物(容斥原理)

Description  硬币购物一共有4种硬币。面值分别为c1,c2,c3,c4。某人去商店买东西,去了tot次。每次带di枚ci硬币,买si的价值的东西。请问每次有多少种付款方法。Input  第一行 c1,c2,c3,c4,tot 下面tot行 d1,d2,d3,d4,s,其中di,s<=100000,tot<=1000Output  每次的方法数Sam...

2019-08-21 10:30:19 422

原创 Andy's First Dictionary

DescriptionXY学长刚刚立下了再不过CET就直播xx的flag,为了不真的开启直播模式,XY学长决定好好学习英语。于是他每天都读一篇只包含生词的英语文章,并以自己高达450的智商在一秒钟之内记忆下来。现在给你一篇XY学长今天要读的文章,请你写一个程序,输出他都学习到了哪些单词。要求:如果文章中有相同的单词,那么仅仅输出一次;而且如果两个单词只有大小写不同,将他们视为相同的单词。...

2019-08-21 10:13:29 87

原创 Alignment of Code (stringstream)

You are working in a team that writes Incredibly Customizable Programming Codewriter (ICPC) which is basically a text editor with bells and whistles. You are working on a module that takes a piece of ...

2019-08-21 09:41:19 97

原创 TEX Quotes

TeX is a typesetting language developed by DonaldKnuth. It takes source text together with a few typesetting instructions and produces, one hopes, a beautiful document. Beautiful documents use `` and...

2019-08-19 10:28:42 159

原创 Lovers

One dayngirls andnboys come to Xi’an to look for a mate. Each girl has a valuea[i], each boy has a valueb[i]. Girliand boyjwill fall in love only ifa[i] +b[j]≥k.Please help them make p...

2019-08-19 09:47:30 117

原创 Secret Poems

The Yongzheng Emperor (13 December 1678 – 8 October 1735), was the fifth emperor of the Qing dynasty of China. He was a very hard-working ruler. He cracked down on corruption and his reign was known f...

2019-08-18 15:01:49 82

原创 兔子与萝北

俗话说的好,兔子不吃窝边草。村子里有n个兔子窝,它们窝门口有a​i​​颗萝北。秉持着一个原则就是不吃窝边草。假如一只兔子吃一个萝北,那么一共有多少兔子能吃得着萝北。输入格式:第一行输入由一个整数T(1≤T≤25)组成,表示测试用例的数量。每个测试用例以一个整数n(1≤n≤10​6​​)的行开始,即兔子窝的数量。对于接下来的n行,每行包含两个整数a,...

2019-08-18 14:10:36 102

原创 保持真实

在计算机科学中,堆是一个专门的基于树的数据结构,它本质上是一个完全树。堆的一些性质:在最小堆中,对于任何给定的结点C,如果P是C的父结点,那么结点P的值小于或等于C的值。堆的“顶部”的结点称为根结点。通常,我们可以用数组h​1​​,h​2​​,......,h​n​​存储大小为n的堆,其中h​i​​表示第i个结点的值。根结点是第1个结点,第i(2...

2019-08-18 14:08:48 228

原创 0的数列

给你一个数列a​1​​,a​2​​,......,a​n​​。你可以选择两个数字,并且把这两个数字同时减去1。对于给定的数列,你能不能按照上述操作使得数列中元素全部为0。输入格式:第一行一个数字T(1≤T≤50),代表T组测试用例。对于每组测试用例:第一行给出一个正整数n(2≤n≤10​6​​),代表数列里元素的个数第二行给出n个正整数a​1​​,a...

2019-08-18 14:06:42 221

原创 Pants On Fire

题目描述Donald and Mike are the leaders of the free world and haven’t yet (after half a year) managed to start a nuclear war. It is so great! It is so tremendous!Despite the great and best success of D...

2019-08-18 13:22:17 285 1

原创 Concerts

题目描述John enjoys listening to several bands, which we shall denote using A through Z. He wants to attend several concerts, so he sets out to learn their schedule for the upcoming season.He finds th...

2019-08-17 10:12:29 347

原创 Cats and Fish

There are many homeless cats in PKU campus. They are all happy because the students in the cat club of PKU take good care of them. Li lei is one of the members of the cat club. He loves those cats ver...

2019-08-16 09:29:08 68

原创 Farey Sums

题目描述Given a positive integer, N, the sequence of all fractions a/b with (0 < a ≤ b), (1 < b ≤ N) and a and b relatively prime, listed in increasing order, is called the Farey Sequence of order...

2019-08-15 09:03:49 81

原创 Islands in the Data Stream II

题目描述Given a sequence of integers a1, a2, a3, . . . , an, an island in the sequence is a contiguous subsequence for which each element is greater than the elements immediately before and after the su...

2019-08-13 16:30:58 114

原创 A Rational Sequence

题目描述An infinite full binary tree labeled by positive rational numbers is defi ned by:• The label of the root is 1/1.• The left child of label p/q is p/(p+q).• The right child ofl abel p/q is (p+q...

2019-08-13 16:07:15 188

原创 强联通分量

#include<bits/stdc++.h> using namespace std;const int maxn = 1e5 + 10; vector<int> G[maxn]; int DFN[maxn], LOW[maxn], index, cnt;int ans[maxn], belong[maxn];bool vis[maxn];stack...

2019-08-13 11:50:37 73

原创 中位数

一个有n个整数的数组a,n是一个奇数。每次可以选择数组里的一个元素a​i​​并把这个元素加上1。在至多k次操作之后,数组的中位数最大能变成多少。输入格式:多组输入第一行两个整数n,k(1≤n≤2×10​5​​,1≤k≤10​9​​)。第二行n和整数a​1​​,a​2​​,......,a​n​​。输出格式:k次操作后数组的中位数。输入样...

2019-08-12 16:41:43 903 2

原创 字符串哈希

给定一个长度为n的字符串,再给定m个询问,每个询问包含四个整数l1,r1,l2,r2,请你判断[l1,r1]和[l2,r2]这两个区间所包含的字符串子串是否完全相同。字符串中只包含大小写英文字母和数字。输入格式第一行包含整数n和m,表示字符串长度和询问次数。第二行包含一个长度为n的字符串,字符串中只包含大小写英文字母和数字。接下来m行,每行包含四个整数l1,r1,l2,r2,表...

2019-08-12 11:20:00 354

原创 计算数列(求贡献)

设表示一个交替两个数字f(a​1​​a​2​​...a​p−1​​a​p​​,b​1​​b​2​​...b​q−1​​b​q​​)的函数,其中a​1​​...a​p​​和b​1​​...b​q​​是以十进制表示法写入的两个整数的数字,不带前导零。换句话说,函数f(x,y)通过将数字x和y从最低位数写入新的数字,从数字y开始,交替地混洗数字x和y。该函数的...

2019-08-12 09:47:16 201

原创 P1012 拼数

题目描述设有nn个正整数(n≤20)(n≤20),将它们联接成一排,组成一个最大的多位整数。例如:n=3n=3时,33个整数1313,312312,343343联接成的最大整数为:3433121334331213又如:n=4n=4时,44个整数77,1313,44,246246联接成的最大整数为:74246137424613输入格式第一行,一个正整数nn。第二行,nn个正整...

2019-08-09 10:03:58 82

原创 P1004 方格取数

题目描述设有N×NN×N的方格图(N≤9)(N≤9),我们将其中的某些方格中填入正整数,而其他的方格中则放入数字00。如下图所示(见样例):A 0 0 0 0 0 0 0 0 0 0 13 0 0 6 0 0 0 0 0 0 7 0 0 0 0 0 0 14 0 0 0 0 0 21 0 0 0 4 0 0 0 ...

2019-08-08 16:51:11 88

原创 全排列

bfs:#include<bits/stdc++.h>using namespace std;struct node { int len, vis[10]; vector<int>s; node() { len = 0; s.clear(); memset(vis,0, sizeof...

2019-08-07 15:42:39 70

原创 Shell Pyramid

题目描述In the 17th century, with thunderous noise, dense smoke and blazing fire, battles on the sea were just the same as those in the modern times. But at that time, the cannon were extremely simple. ...

2019-08-07 09:12:13 103

原创 Simple Addition expression

题目描述A luxury yacht with 100 passengers on board is sailing on the sea in the twilight. The yacht is ablaze with lights and there comes out laughers and singing from the hall where an evening party ...

2019-08-07 08:56:43 112

原创 后缀数组

步骤:1、找出所有的后缀序列2、将这些后缀序列按照字典序排列3、得到rank数组,sa数组4、根据排列好的顺序找最长前缀的长度,height数组代码实现利用基数排序得到sa,rank数组后缀数组应用:http://dongxicheng.org/structure/suffix-array/#include <cstdio>...

2019-08-05 10:31:31 91

原创 AC自动机

作用:判断多种字符串是否存在于另一字符串中,存在位置和哪种字符举个例子,假如现在给出5个模式串:say she shr he her主串是:yasherhs现在问你,这5个模式串有几个出现在主串里的?OK,现在就拿这个例子来完成这个算法的过程。第一步:构建Trie树,这很简单的了。构建好后,出现下图:第二步:构建失败指针构建失败指针是AC自动机的核心所在,玩转...

2019-08-01 16:50:26 86

空空如也

空空如也

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

TA关注的人

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