自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 2019 Multi-University Training Contest 1------Vacation

题目链接:https://vjudge.net/problem/HDU-6581题意:有n+1辆车排成一列往终点行驶(行驶过程中不能超车),每辆车有各自的车长、离停止线的距离和车速,你的车在最后一个位置,问你的车头到达停止线所需的最少时间。思路:每一辆车都需要为后面的车辆腾出一定的距离(距离停止线的长度加上后面所有车(除最后一辆车)的车身长度),以至于每辆车都能通过停止...

2019-08-22 12:19:09 156

原创 10050. 「一本通 2.3 例 2」The XOR Largest Pair

题目链接:https://loj.ac/problem/10050思路:把每一个数字 x 转化为31位的二进制数,不够的前面补0,并插入到字典树中(最低为二进制位为叶节点);接下来对每一个数字 x 的二进制位进行查找,每一步都尽量找与当前位置相反的数字进行访问,入如果有相反的数字,根据xor运算这一位就会留下一个 1 ,最后找出最大值就行。代码:#include<bits/...

2019-07-17 09:37:10 368

原创 「一本通 2.3 例 1」Phone List

题目链接:https://loj.ac/problem/10049思路:字典树模板题具体看代码#include<bits/stdc++.h>#define ll long long#define N 100861#define inf 0x3f3f3f3fusing namespace std;int ch[10][N],tot;bool book[N];voi...

2019-07-15 15:19:50 249

原创 Apple Tree————POJ—3321

题目:There is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree.The tree h...

2019-05-02 16:03:17 288

原创 Roadblocks ———POJ - 3255 (次短路)

题目:Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, because she likes the scenery along the way...

2019-04-28 08:49:37 140

原创 The contest———CSU - 1326(分组背包、并查集)

题目: 殷犇有很多队员。他们都认为自己是最强的,于是,一场比赛开始了~ 于是安叔主办了一场比赛,比赛有n个题目,每个题目都有一个价值Pi和相对能力消耗Wi,但是有些题目因为太坑不能同时做出来,并且坑题具有传递性。(a和b一起做会坑、b和c会坑则a和c也会坑) ACM队员们想知道,于是他们想知道在能力范围内,它们最多可以作出多少价值的题目。 聪明的你,告诉我,能帮帮他们吗?In...

2019-04-24 19:54:57 118

原创 Almost Union-Find(并查集 删除)——UVa 11987

题目:Almost Union-FindI hope you know the beautiful Union-Find structure. In this problem, you're to implement something similar, but not identical.The data structure you need to write is also a co...

2019-04-23 09:23:21 152

原创 欧拉函数模板——快速求小于n且与n互质的数的个数

nlog(n)打表欧拉函数:void Euler(){ phi[1] = 1; for(int i=2;i<N;i++) { if(!phi[i]) { for(int j=i;j<N;j=j+i) { if(!phi[j]) ...

2019-04-09 08:46:41 606

原创 Fibonacci————矩阵快速幂求斐波那契数列

题目:In the Fibonacci integer sequence,F0= 0,F1= 1, andFn=Fn− 1+Fn− 2forn≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …An alte...

2019-04-04 20:53:32 241

原创 树上战争 HDU - 2545

题目:给一棵树,如果树上的某个节点被某个人占据,则它的所有儿子都被占据,lxh和pfz初始时分别站在两个节点上,谁当前所在的点被另一个人占据,他就输了比赛,问谁能获胜Input输入包含多组数据每组第一行包含两个数N,M(N,M<=100000),N表示树的节点数,M表示询问数,N=M=0表示输入结束。节点的编号为1到N。接下来N-1行,每行2个整数A,B(1<=A...

2019-03-29 15:38:54 123

原创 L2-020 功夫传人

题目:一门武功能否传承久远并被发扬光大,是要看缘分的。一般来说,师傅传授给徒弟的武功总要打个折扣,于是越往后传,弟子们的功夫就越弱…… 直到某一支的某一代突然出现一个天分特别高的弟子(或者是吃到了灵丹、挖到了特别的秘笈),会将功夫的威力一下子放大N倍 —— 我们称这种弟子为“得道者”。这里我们来考察某一位祖师爷门下的徒子徒孙家谱:假设家谱中的每个人只有1位师傅(除了祖师爷没有师傅);每位师...

2019-03-27 16:58:04 116

原创 L2-005 集合相似度

题目:给定两个整数集合,它们的相似度定义为:N​c​​/N​t​​×100%。其中N​c​​是两个集合都有的不相等整数的个数,N​t​​是两个集合一共有的不相等整数的个数。你的任务就是计算任意一对给定集合的相似度。输入格式:输入第一行给出一个正整数N(≤50),是集合的个数。随后N行,每行对应一个集合。每个集合首先给出一个正整数M(≤10​4​​),是集合中元素的个数;然后跟M个[0,...

2019-03-27 14:28:58 96

原创 L3-002 特殊堆栈

题目:堆栈是一种经典的后进先出的线性结构,相关的操作主要有“入栈”(在堆栈顶插入一个元素)和“出栈”(将栈顶元素返回并从堆栈中删除)。本题要求你实现另一个附加的操作:“取中值”——即返回所有堆栈中元素键值的中值。给定 N 个元素,如果 N 是偶数,则中值定义为第 N/2 小元;若是奇数,则为第 (N+1)/2 小元。输入格式:输入的第一行是正整数 N(≤10​5​​)。随后 N 行,每...

2019-03-27 11:14:53 484

原创 Cash Machine--(背包,二进制优化)

题目:A Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N distinct bill denominations, say ...

2019-03-15 17:54:10 121

原创 51nod-1379 扔盘子

题目:有一口井,井的高度为N,每隔1个单位它的宽度有变化。现在从井口往下面扔圆盘,如果圆盘的宽度大于井在某个高度的宽度,则圆盘被卡住(恰好等于的话会下去)。盘子有几种命运:1、掉到井底。2、被卡住。3、落到别的盘子上方。盘子的高度也是单位高度。给定井的宽度和每个盘子的宽度,求最终落到井内的盘子数量。  如图井和盘子信息如下:井:5 6 4 3 6 2 3盘子:2...

2019-02-17 15:52:25 166

原创 A + B for you again hdu 1867

题目:Generally speaking, there are a lot of problems about strings processing. Now you encounter another such problem. If you get two strings, such as “asdf” and “sdfg”, the result of the addition bet...

2018-12-14 17:51:46 138

原创 Frosh Week HDU - 3743

题目:During Frosh Week, students play various fun games to get to know each other and compete against other teams. In one such game, all the frosh on a team stand in a line, and are then asked to arra...

2018-12-09 09:13:18 239

转载 upper_bound()和low_bound函数的基本使用和理解(转)

博客链接:https://blog.csdn.net/sdz20172133/article/details/80101838

2018-12-07 19:23:57 526

原创 I Hate It 线段树

题目:很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0&lt;N&lt;=200000,0&lt;M...

2018-12-01 08:57:30 137

原创 Math CodeForces - 1062B

题目:传送门 题意:输入一个n,问经过最少多少次操作可以使n变得最小、最小值是多少?操作一:把n乘以一个数;操作二:把n开平方; 思路:把n化为质因数相乘的形式,比如一个数可以化为2^4*3^5*5^7*7^2;找出指数最大是多少(假如是m),找到比m大且是2的指数次方的数k;这时候就相当于把n乘以一个数变成2^k*3^k*5^k*7^k;再对这个数...

2018-11-30 20:12:02 181

原创 Cutting Out CodeForces - 1077D

题目:You are given an array s consisting of n integers.You have to find any array t of length kk such that you can cut out maximum number of copies of array t from array ss.Cutting out the copy of...

2018-11-24 09:12:18 326

原创 Line

题目:A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from  - 5·1018 to 5·1018 inclusive, or to find out t...

2018-09-02 21:50:41 178

原创 Aladdin and the Flying Carpet

题目:It's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery.Aladdin was about to enter to a...

2018-09-02 21:35:35 263

原创 统计难题

题目:Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符...

2018-09-02 21:25:33 102

原创 超级密码

题目:Ignatius花了一个星期的时间终于找到了传说中的宝藏,宝藏被放在一个房间里,房间的门用密码锁起来了,在门旁边的墙上有一些关于密码的提示信息: 密码是一个C进制的数,并且只能由给定的M个数字构成,同时密码是一个给定十进制整数N(0&lt;=N&lt;=5000)的正整数倍(如果存在多个满足条件的数,那么最小的那个就是密码),如果这样的密码存在,那么当你输入它以后门将打开,如果不存在这...

2018-08-26 21:33:06 2182

原创 Anniversary party

题目:There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms...

2018-08-26 21:23:50 135

原创 度度熊学队列

题目:度度熊正在学习双端队列,他对其翻转和合并产生了很大的兴趣。初始时有 N 个空的双端队列(编号为 1 到 N ),你要支持度度熊的 Q 次操作。①1 u w val 在编号为 u 的队列里加入一个权值为 val 的元素。(w=0 表示加在最前面,w=1 表示加在最后面)。②2 u w 询问编号为 u 的队列里的某个元素并删除它。( w=0 表示询问并操作最前面的元素,w=1 表示最后...

2018-08-26 21:18:49 183

原创 The Falling Leaves

题目:题目连接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&amp;Itemid=8&amp;page=show_problem&amp;problem=640 题意:给一个先序二叉树,其中左子结点在父节点左一个单位,右节点在父节点右一个单位;让从左到右输出每个水平位置的权值和; 思路:定...

2018-08-26 21:15:02 253

原创 Tree

题目:You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf. The value of a path is the ...

2018-08-26 21:00:04 165

原创 The order of a Tree

题目:As we know,the shape of a binary search tree is greatly related to the order of keys we insert. To be precisely: 1.  insert a key k to a empty tree, then the tree become a tree with only one no...

2018-08-26 20:42:59 309

原创 Trees on the level

题目:Trees are fundamental in many branches of computer science. Current state-of-the art parallel computers such as Thinking Machines' CM-5 are based on fat trees. Quad- and octal-trees are fundament...

2018-08-26 20:34:36 168

原创 二叉搜索树

题目:判断两序列是否为同一二叉搜索树序列Input开始一个数n,(1&lt;=n&lt;=20) 表示有n个需要判断,n= 0 的时候输入结束。 接下去一行是一个序列,序列长度小于10,包含(0~9)的数字,没有重复数字,根据这个序列可以构造出一颗二叉搜索树。 接下去的n行有n个序列,每个序列格式跟第一个序列一样,请判断这两个序列是否能组成同一颗二叉搜索树。Output如果...

2018-08-26 20:02:59 156

原创 Super Jumping! Jumping! Jumping!

题目:Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now. The ...

2018-08-26 19:55:41 238

原创 Robot Rapping Results Report

题目:While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competiti...

2018-08-26 19:47:00 160

原创 Not so Mobile

题目连接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&amp;Itemid=8&amp;page=show_problem&amp;problem=780 题意:给你一个杠杆两端的物体的质量和力臂,如果质量为零,则下面是一个杠杆,判断是否所有杠杆平衡。 思路:递归输入,判断左右是否平衡; ...

2018-08-25 11:46:44 150

原创 S-Trees

题目:题目连接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&amp;Itemid=8&amp;page=show_problem&amp;problem=653题意:给出满二叉树叶结点的所有值,输入0代表向左走输入1代表向右走,输出最后到达的叶子的值。 思路:根据满二叉树的性质,向左走编号*2,向...

2018-08-25 11:24:54 171

原创 二叉树模板

最近学习的,关于二叉树的建立,前中后序遍历,和求二叉树高等。#include&lt;stdio.h&gt;#include&lt;stdlib.h&gt;typedef struct node{ int date; struct node* left; struct node* right;} Node;typedef struct{ Node...

2018-08-25 10:31:41 120

原创 Functions again

题目:Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon th...

2018-08-19 21:40:06 179

原创 Mr. Kitayuta's Colorful Graph

题目:Mr. Kitayuta has just bought an undirected graph consisting of n vertices and m edges. The vertices of the graph are numbered from 1 to n. Each edge, namely edge i, has a color ci, connecting ver...

2018-08-19 21:32:31 173

原创 Tree Recovery

题目:Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes. This is an example of one of her c...

2018-08-19 21:20:19 119

空空如也

空空如也

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

TA关注的人

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