自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 哈希算法

一、学习要点:1.哈希表是一个很神奇的东西,即解决了数组的增删的繁琐,也解决了链表的查找问题;2.哈希表的哈希函数;3.哈希表的冲突问题解决;什么叫做闭散列,什么叫做开散列;闭,严重遵守哈希内涵。开,有点开放的意味,解决冲突靠链表,有点变味的哈希;二、相关数据结构解读:1.构造一种存储结构,通过某种函数使元素的存储位置与它的关键码之间建立一种一一映射的关系,那么在查找时通过该函数可以很快找到该元素;2.哈希函数是用来得到给定key值在哈希表中的存储位置的;3.哈希函数也并不是固定的,可以自己根

2021-05-09 15:32:39 278

原创 C++精度

cout<<fixed //用一般的方式输出浮点型,例如C++程序在控制台显示的时候大一点的数,显示的时候使用了科学计数法,使用该命令即可像一般的方式显示cout.precision(2) //设置精确度为2,并返回上一次的设置。cout.setf(iOS_base::showpoint) //显示浮点数小数点后面的零。原文博客:https://blog.csdn.net/septemberAs/article/details/68489554...

2021-02-26 10:45:34 592

原创 Mortal Kombat Tower

***C. Mortal Kombat Tower***You and your friend are playing the game Mortal Kombat XI. You are trying to pass a challenge tower. There are n bosses in this tower, numbered from 1 to n. The type of the i-th b## oss is ai. If the i-th boss is easy t...

2020-09-18 17:00:23 326

原创 无题

Every girl likes shopping,so does dandelion.Now she finds the shop is increasing the price every day because the Spring Festival is coming .She is fond of a shop which is called “memory”. Now she wants to know the rank of this shop’s price after the change

2020-09-02 16:26:07 254

原创 Counting Game

There are n people standing in a line, playing a famous game called counting". When the game begins, the leftmost person says1" loudly, then the second person (people are numbered 1 to n from left to right) says 2" loudly. This is followed by the 3rd perso

2020-07-23 20:54:47 521

原创 Anya and Ghosts

题目:添加链接描述题目大意:给出n个鬼访问的时间,和每个蜡烛可以持续的时间,每次访问最少需要的点燃的蜡烛数。问一共最少需要几个蜡烛。将每个蜡烛的点燃的时间尽量靠近访问的时间,所以,统计第i个访问时点燃的蜡烛,如果少于r,那么要访问的时间开始,向前遍历,找出最近的可以点燃蜡烛的时刻,这样可以保证使用的蜡烛最少。注意1、可以在子夜之前点蜡烛,所以要将时间右移。2、蜡烛持续的时间t和点燃的时间j的关系为,j时刻点蜡烛,j+1到j+t时刻蜡烛亮着。#include <cstdio>#inc

2020-06-21 14:17:21 160

原创 Diagonal Walking v.2

题目地址:添加链接描述题意:从 (0,0) 走到 (n,m),每一步可以向八个方向走一格,问恰好走 k 步能否到达,能到达则输出最多能走多少斜步;首先,判断 -1 就看横纵距离中的较大值是否大于 k ,因为最少走 max(n,m) 步可以到达;设 m > n;如果 m - n 为奇数,那么显然会有一步必须直着走,那么 k --;这里可以通过走法来调节剩余步数的奇偶,就是直着走过去或者拐一下走过去的区别,所以到达后不会再有 k 的损失;如果 m - n 为偶数,首先可以全部斜着走过去;到

2020-06-21 14:15:34 107

原创 取石子游戏

有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。Input输入包含若干行,表示若干种石子的初始情况,其中每一行包含两个非负整数a和b,表示两堆石子的数目,a和b都不大于1,000,000,000。Output输出对应也有若干行,每行包含一个数字1或0,如果

2020-05-23 20:35:36 403

原创 Product of Three Numbers

You are given one integer number n. Find three distinct integers a,b,c such that 2≤a,b,c and a⋅b⋅c=n or say that it is impossible to do it.If there are several answers, you can print any.You have to answer t independent test cases.InputThe first line o

2020-05-11 20:30:56 136

原创 Number Sequence

Given 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] = b[1], a[K + 1] = b[2], … , a[K + M - 1] = b[M]. If there are more than one K

2020-05-11 20:28:35 93

原创 Oulipo(KMP)

The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book:Tout avait Pair normal, mais tout s’affirmait faux. Tout avait Fair normal, d’abord, puis sur

2020-05-10 12:52:08 119

原创 Three Blocks Palindrome (easy version)

题目在下方链接中:添加链接描述思路如下1.将数组分成[1,i-1],[i,j],[j+1,n]三个区间找雷同数字数量,全部用前缀和维护。2.在[1,i-1]区间内找出雷同数字的数量l,[j+1,n]区间内找出与左区间同一雷同数字的数量r,取最小值l=min(l,r)遍历26个数字,找上述l的最大值3.在[i,j]区间,找雷同字母数量mid遍历26个数字,找上述mid的最大值4.答案就是...

2020-04-26 17:54:34 254

原创 Challenges in school №41

There are n children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and tur...

2020-04-22 18:21:36 195

原创 Eugene and an array

Eugene likes working with arrays. And today he needs your help in solving one challenging task.An array c is a subarray of an array b if c can be obtained from b by deletion of several (possibly, zer...

2020-04-16 12:39:44 181

原创 Phalanx(dp)

Today is army day, but the servicemen are busy with the phalanx for the celebration of the 60th anniversary of the PRC.A phalanx is a matrix of size nn, each element is a character (a~z or A~Z), stan...

2020-04-06 17:35:53 170

原创 Marcin and Training Camp

Marcin is a coach in his university. There are n students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.Let’s...

2020-04-06 16:42:34 140

原创 Coins and Queries

Polycarp has n coins, the value of the i-th coin is ai. It is guaranteed that all the values are integer powers of 2 (i.e. ai=2d for some non-negative integer number d).Polycarp wants to know answers...

2020-03-26 09:19:14 155

原创 Kefa and Park

Kefa decided to celebrate his first big salary by going to the restaurant.He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also cont...

2020-03-26 09:10:15 143

原创 Yet Another Walking Robot(奇妙的记录方式)

There is a robot on a coordinate plane. Initially, the robot is located at the point (0,0). Its path is described as a string s of length n consisting of characters ‘L’, ‘R’, ‘U’, ‘D’.Each of these c...

2020-03-22 10:59:29 313

原创 Skyscrapers (easy version)

This is an easier version of the problem. In this version n≤1000The outskirts of the capital are being actively built up in Berland. The company “Kernel Panic” manages the construction of a residenti...

2020-03-19 14:48:43 299

原创 Friends and Gifts

There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself.For each f...

2020-03-17 12:29:59 111

原创 Fight with Monsters

There are n monsters standing in a row numbered from 1 to n. The i-th monster has hi health points (hp). You have your attack power equal to a hp and your opponent has his attack power equal to b hp....

2020-03-17 12:28:04 226

原创 Binary Tree

The Old Frog King lives on the root of an infinite tree. According to the law, each node should connect to exactly two nodes on the next level, forming a full binary tree.Since the king is profession...

2020-02-19 13:29:08 117

原创 Counting Cliques

A clique is a complete graph, in which there is an edge between every pair of the vertices. Given a graph with N vertices and M edges, your task is to count the number of cliques with a specific size ...

2020-02-16 17:38:12 208

原创 Rabbits

Here N (N ≥ 3) rabbits are playing by the river. They are playing on a number line, each occupying a different integer. In a single move, one of the outer rabbits jumps into a space between any other ...

2020-02-16 16:55:54 441 1

原创 Little Boxes

Little boxes on the hillside.Little boxes made of ticky-tacky.Little boxes.Little boxes.Little boxes all the same.There are a green boxes, and b pink boxes.And c blue boxes and d yellow boxes.A...

2020-02-16 12:52:52 214

原创 Tree

Consider a un-rooted tree T which is not the biological significance of tree or plant, but a tree as an undirected graph in graph theory with n nodes, labelled from 1 to n. If you cannot understand th...

2020-02-15 16:06:19 110

原创 Find Small A

As is known to all,the ASCII of character ‘a’ is 97. Now,find out how many character ‘a’ in a group of given numbers. Please note that the numbers here are given by 32 bits’ integers in the computer.T...

2020-02-12 13:59:47 232

原创 A Simple Math Problem

Given two positive integers a and b,find suitable X and Y to meet the conditions:X+Y=aLeast Common Multiple (X, Y) =bInputInput includes multiple sets of test data.Each test data occupies one line...

2020-02-09 13:10:57 68

原创 Pocket Cube

The Pocket Cube, also known as the Mini Cube or the Ice Cube, is the 2 × 2 × 2 equivalence of a Rubik’s Cube.The cube consists of 8 pieces, all corners.Each piece is labeled by a three dimensional c...

2020-02-09 13:03:46 180

原创 Pocky

Let’s talking about something of eating a pocky. Here is a Decorer Pocky, with colorful decorative stripes in the coating, of length L.While the length of remaining pocky is longer than d, we perform...

2020-02-09 12:45:10 222

原创 江西省赛Wave

Avin is studying series. A series is called “wave” if the following conditions are satisfied:It contains at least two elements;All elements at odd positions are the same;All elements at even posit...

2019-11-19 16:48:48 117

原创 Bookshelf 2

Farmer John recently bought another bookshelf for the cow library, but the shelf is getting filled up quite quickly, and now the only available space is at the top.FJ has N cows (1 ≤ N ≤ 20) each wit...

2019-11-06 17:50:54 284

原创 背包模板题Charm Bracelet

Bessie has gone to the mall’s jewelry store and spies a charm bracelet. Of course, she’d like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each charm i in the ...

2019-11-06 17:45:12 95

原创 敌兵布阵

C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以...

2019-11-06 17:09:26 70

原创 The Settlers of Catan UVA

Within Settlers of Catan, the 1995 German game of the year, players attempt to dominate an island by building roads, settlements and cities across its uncharted wilderness.You are employed by a softw...

2019-11-06 17:04:01 116

原创 Queen

You are given a rooted tree with vertices numerated from 1 to n. A tree is a connected graph without cycles. A rooted tree has a special vertex named root.Ancestors of the vertex i are all vertices o...

2019-10-23 19:21:20 128

原创 4 Values whose Sum is 0

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 = 0 . In the followin...

2019-10-09 16:54:01 67

原创 4 Values whose Sum is 0

**4 Values whose Sum is 0 *斜体样式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 +...

2019-10-09 16:51:40 267

原创 Wukong(好题)

Alice每天往返于A、B,Bob每天往返于C、D。他们很忙所以每次都会挑选最短的路线,尽管如此他们仍想增加见面的机会。他们认为两个人所选路线的公共点越多见面机会越多。Input多组测试。每组测试的第一行为两个数字N(1 <= N <= 300)、 M (1 <= M <= N*N),接下来是M行,每行三个数字a、b、c,代表a、b之间有一条长度为c的无向路,然后是...

2019-09-23 20:39:14 117

空空如也

空空如也

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

TA关注的人

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