自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

xiang_hehe的博客

革命尚未成功,同志必须努力

  • 博客(179)
  • 收藏
  • 关注

原创 Codeforces Round #547 (Div. 3)D. Colored Boots【模拟,字符串】

D. Colored Boots题目大意:给你两个字符串,问你这两组字符串相同字符在各自所在字符的位置是如何。而且每一个字符串中“?”字符可以与任何字符相匹配。大致思路:这道题的贪心思路很好想:先找连个字符串中字符相同的,再找第一个字符串和第二个串字符“?”匹配的,再找第一个字符串中“?”和第二个字符串中字符相匹配的,最后找两个字符串中剩下的“?”字符。难点在于这道题的代码实现:我们可...

2019-03-31 10:16:03 248

原创 Codeforces Round #547 (Div. 3)B. Maximal Continuous Rest【模拟】

B. Maximal Continuous Rest题目大意:给你一组由0 和 1组成的数据表示一个人的工作日程表(每天都一样),0表示工作,1表示休息。问你最长可以连续休息几天。如果第一天最后一段时间是休息的,而第二天一开始也休息也可以看成是连续的。题目大致思路:直接按照题意模拟即可,同时要注意下一天的一开始是不是休息的,如果是也要算在前一天的范围内。#include <bi...

2019-03-31 09:57:30 189

原创 Codeforces Round #547 (Div. 3)(A,C两题)【数学,思维】

A Game 23题目大意:给你两个数字,一个数字只能通过*2 和*3来得到另一个数字,问需要多少不才能从一个数字变成另一个数字。大致思路:如果数字a能够变成数字b,则数字b一定可以整除数字a,然后再用他们的商先除2,在除3最后统计一共除了多少下,就是最后的答案了。#include <bits/stdc++.h>using namespace std;long l...

2019-03-31 09:50:13 170

原创 洛谷P1101——单词方阵

单词方阵大致思路:首先我们可以遍历整个单词方阵,找到每一个y开头的地方,然后沿着这8个方向寻找i,如果找到了i,我们就可以沿着这个方向继续查找下去,在查找的过程中我们要保证下一个单词必须与“yizhong”里相应次序的单词相同。#include <iostream>#include <algorithm>#include <cstring>#in...

2019-03-31 09:34:58 218

原创 luoguP1019——单词接龙【DFS】

单词接龙题目链接如上。题目大致思路:首先我们知道了首字母是哪一个,然后我们就可以一一枚举其他所有字母找到拼接最长的。这道题的难点就在于拼接操作。我们可以枚举两个拼接字符串的所有接口长度,判断该接口长度是否能够进行拼接,如果可以则继续搜索。同时我们还需要用一个数组记录一下每一个字符的使用次数,每一个字符的使用最多一次。#include <algorithm>#includ...

2019-03-31 09:27:30 181

原创 洛谷P1955——自动程序分析【并查集 + 离散化】

洛谷P1955——自动程序分析大致思路:我们先把可以划等号的数字划到同一个集合中,然后再在把划不等号的判断一下看有没有在同一个集合中的,如果有输出NO,无输出YES,这道题的数据给的是1E9如果直接存到数组中去肯定会TLE,我们可以用离散化处理一下。#include &lt;algorithm&gt;#include &lt;cstdio&gt;#include &lt;cstrin...

2019-02-17 19:35:29 166

原创 洛谷P5149——会议座位【字典树 + 逆序对】

洛谷P5149——会议座位大致思路:我们先用字典树把单词存起来,在每个单词的末尾节点给这个单词按照出现顺序标号,然后在查找的过程中,把其出现顺序用一个数组一次存起来,然后求这个数组的逆序对即可。#include &lt;algorithm&gt;#include &lt;cstdio&gt;#include &lt;iostream&gt;#include &lt;cstring&...

2019-02-17 19:26:51 331

原创 POJ3630——Phone List【字典树】

poj_3630题目大意:给你一组字符串,让你判断这其中的某一个字符串是不是其他字符串的前缀,如果是输出NO,否则输出YES。大致思路:这道题我们可以用字典树来做,在每一个字符串后面一个节点加一个标记,标记一下这个字符串已经存在了。在字符串输入的时候判断一下其前缀是否已经出现了。#include &lt;algorithm&gt;#include &lt;cstdio&gt;#i...

2019-02-15 20:05:42 179

原创 HDU1251——统计难题【字典树】

HDU1251——统计难题大致思路:我们可以让字典树的节点记录每一个节点的出现的次数,然后在我们查找的过程中直接查找最后一个字符对应的节点的次数即可。#include &lt;algorithm&gt;#include &lt;cstdio&gt;#include &lt;cstring&gt;#include &lt;iostream&gt;using namespace s...

2019-02-13 21:30:56 169

原创 Codeforces670C—— Cinema【map/离散化,排序】

C. Cinematime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMoscow is hosting a major international conference, which is attended b...

2019-01-31 10:48:20 416 1

原创 Codeforces Round #534 (Div. 2)______B. Game with string[字符串,模拟]

Two people are playing a game with a string ss, consisting of lowercase latin letters.On a player's turn, he should choose two consecutive equal letters in the string and delete them.For example, ...

2019-01-23 14:59:50 438

原创 Codeforces Round #533 (Div. 2)B. Zuhair and Strings[字符串,模拟]

B. Zuhair and Stringstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven a string ss of length nn and integer kk (1≤k≤n1≤k≤n). ...

2019-01-23 14:54:33 154

原创 Codeforces Round #533 (Div. 2)A. Salem and Sticks[思维,数学,水题]

A. Salem and SticksSalem gave you nn sticks with integer positive lengths a1,a2,…,ana1,a2,…,an.For every stick, you can change its length to any other positive integer length (that is, either shri...

2019-01-23 14:43:38 476

原创 HDU3085——Nightmare Ⅱ【双向BFS】

Nightmare Ⅱ双向BFS板子题记录一下。#include &lt;iostream&gt;#include &lt;cstdio&gt;#include &lt;algorithm&gt;#include &lt;cstring&gt;#include &lt;queue&gt;using namespace std;typedef pair&lt;int,int&...

2018-12-31 19:01:56 135

原创 UVA208—— Firetruck【DFS + 并查集】

The Center City fire department collaborates with the transportation department to maintain maps of the city which reflects the current status of the city streets. On any given day, several streets ar...

2018-12-31 18:46:25 164

原创 UVA 12325—— Zombie's Treasure Chest【枚举,暴力】

Some brave warriors come to a lost village. They are very lucky and find a lot of treasures and a big treasure chest, but with angry zombies. The warriors are so brave that they decide to defeat the z...

2018-12-31 18:33:40 166

原创 洛谷P1449——后缀表达式【栈】

洛谷P1449——后缀表达式【栈】简单的用栈模拟一下就可以了,但要注意这道题要输入的是多位数,另外不用考虑太多输入的数字均为正整数。#include &lt;bits/stdc++.h&gt;using namespace std;typedef long long ll;stack&lt;ll&gt; st;bool Check(char x){ if(x != '+'...

2018-12-31 17:52:54 260

原创 HDU4699——Editor【对顶栈,模拟】

HDU4699——Editor题目大意:按照题目所给操作维护一个整数序列编辑器。大致思路:建立两个栈A,B。A栈存储序列开头到当前光标位置的这一段子序列,B存储当前光标位置到序列结尾这一段子序列。用数组f维护栈A的前缀和的最大值,sum用来记录前缀和的值。对于操作I,把x插入栈A,并且更新f[pa],sum[pa]的值,对于操作D,把A的栈顶出栈,对于操作R,弹出B的栈顶插入到A中并且更新...

2018-12-31 17:02:33 178

原创 POJ2248——Addition Chains【DFS,迭代加深搜索】

题目连接:http://poj.org/problem?id=2248题目大意:现在有一个数组其中a[1] = 1,a[m] = n,并且a[1] &lt; a[2] &lt; ........&lt; a[m],现在给你一个数n问,满足条件的m的最小值为多少。其中1 &lt;= n &lt;= 9大致思路:如果我们按照DFS直接搜索的话,一共有n!个节点十分耗时,这个时候我们可以采用迭代...

2018-11-30 21:59:59 1015

原创 HDU3336——Count the string【扩展KMP】

Count the stringTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14735    Accepted Submission(s): 6734 Problem DescriptionIt is well know...

2018-11-09 11:35:05 156

原创 HDU1238——Substrings【KMP,枚举】

SubstringsTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12486    Accepted Submission(s): 6001 Problem DescriptionYou are given a numbe...

2018-11-09 11:23:32 150

原创 HDU2609——How many【最小表示法,set去重】

How manyTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4190    Accepted Submission(s): 1925 Problem DescriptionGive you n ( n &lt; 1000...

2018-11-09 11:16:12 112

原创 poj3080——Blue Jeans【KMP】

Blue JeansTime Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21643   Accepted: 9609 DescriptionThe Genographic Project is a research partnership between IBM and The Natio...

2018-10-26 22:54:08 170

原创 Educational Codeforces Round 52 (Rated for Div. 2)B. Vasya and Isolated Vertices·「模拟,思维」

B. Vasya and Isolated Verticestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya has got an undirected graph consisting of nn ...

2018-10-25 12:52:03 166

原创 Codeforces Round #516 (Div. 2, by Moscow Team Olympiad)D. Labyrinth·「BFS」

D. Labyrinthtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are playing some computer game. One of its levels puts you in a ...

2018-10-23 23:30:55 120

原创 Codeforces Round #515 (Div. 3)E. Binary Numbers AND Sum【数学】

E. Binary Numbers AND Sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two huge binary integer numbers aa and bb ...

2018-10-14 22:42:26 374 1

原创 Codeforces Round #515 (Div. 3)C. Books Queries【模拟,思维】

C. Books Queriestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have got a shelf and want to put some books on it.You are ...

2018-10-14 22:37:19 475

原创 Codeforces Round #515 (Div. 3)B. Heaters【模拟,思维】

B. Heaterstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVova's house is an array consisting of nn elements (yeah, this is the f...

2018-10-14 22:27:04 365

原创 Codeforces Round #515 (Div. 3)A. Vova and Train【水题】

A. Vova and Traintime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVova plans to go to the conference by train. Initially, the trai...

2018-10-14 22:19:38 395

原创 洛谷P1160——队列安排【链表,模拟】

一个学校里老师要将班上NN个同学排成一列,同学被编号为$1~N$,他采取如下的方法: 先将11号同学安排进队列,这时队列中只有他一个人; 2-N2−N号同学依次入列,编号为i的同学入列方式为:老师指定编号为i的同学站在编号为1-(i -1)1−(i−1)中某位同学(即之前已经入列的同学)的左边或右边; 3.从队列中去掉M(M&lt;N)M(M&lt;N)个同学,其他同学位置顺序...

2018-10-11 20:33:15 543

原创 codeforces1051C—— Vasya and Multisets【思维,模拟】

C. Vasya and Multisetstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya has a multiset ss consisting of nn integer numbers. V...

2018-10-07 22:13:07 297

原创 codeforces1051B——Relatively Prime Pairs【思维,数学】

B. Relatively Prime Pairstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a set of all integers from ll to rr inclu...

2018-10-07 22:06:32 153

原创 codeforces1051A——Vasya And Password【暴力,模拟】

A. Vasya And Passwordtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya came up with a password to register for EatForces — a ...

2018-10-07 22:01:49 311 1

原创 uva1593—— Alignment of Code 【stl,模拟】

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 ...

2018-09-17 13:39:42 138

原创 牛客oi赛制测试赛F——假的数学游戏【数论,二分】

链接:https://www.nowcoder.com/acm/contest/185/F来源:牛客网 输入一个整数X,求一个整数N,使得N!恰好大于XX。 输入描述:第一行:一个整数X输出描述:第一行:一个整数N示例1输入复制7输出复制10备注:每个测试点所对应的X满足:第i个测试点输入的值为第i-1个测试点输入的...

2018-09-10 23:35:06 96

原创 牛客oi赛制测试赛2E——括号序列

链接:https://www.nowcoder.com/acm/contest/185/E来源:牛客网 给定括号长度N,给出一串括号(只包含小括号),计算出最少的交换(两两交换)次数,使整个括号序列匹配。我们认为一个括号匹配,即对任意一个')',在其左侧都有一个'('与它匹配,且他们形成一一映射关系。输入描述:第一行:整数N,表示括号序列长度第二行:一个字符串,表示括号输...

2018-09-10 23:28:33 229

原创 牛客oi赛制测试赛2D——星光晚餐

链接:https://www.nowcoder.com/acm/contest/185/D来源:牛客网 Johnson和Nancy要在星光下吃晚餐。这是一件很浪漫的事情。为了增加星光晚餐那浪漫的氛围,他拿出了一个神奇的魔法棒,并且可以按照一定的规则,改变天上星星的亮暗。Johnson想考考Nancy,在他挥动魔法棒后,会有多少颗星星依旧闪耀在天空。他知道,Nancy一定会一口说出...

2018-09-10 23:08:20 145

原创 牛客oi测试赛2C——数列下标【模拟,水题】

链接:https://www.nowcoder.com/acm/contest/185/C来源:牛客网 给出一个数列 A,求出一个数列B.其中Bi   表示 数列A中 Ai 右边第一个比 Ai 大的数的下标(从1开始计数),没有找到这一个下标  Bi 就为0输出数列B输入描述: 第一行1个数字 n (n ≤ 10000)第二行n个数字第 i 个数字为 Ai (0...

2018-09-10 23:05:16 234

原创 牛客oi赛制测试赛2B——路径数量【动态规划/矩阵乘法】

链接:https://www.nowcoder.com/acm/contest/185/B来源:牛客网 给出一个 n * n 的邻接矩阵A.A是一个01矩阵 .A[i][j]=1表示i号点和j号点之间有长度为1的边直接相连.求出从 1 号点 到 n 号点长度为k的路径的数目.输入描述:第1行两个数n,k (20 ≤n ≤ 30,1 ≤ k ≤ 10)第2行至第n+1...

2018-09-10 23:02:55 155

原创 牛客oi赛制测试赛A——无序组数【数学,模拟,思维】

链接:https://www.nowcoder.com/acm/contest/185/A来源:牛客网 给出一个二元组(A,B)求出无序二元组(a,b) 使得(a|A,b|B)的组数无序意思就是(a,b)和(b,a) 算一组.输入描述:第一行数据组数 T(1≤T≤10000)接下来T行,每行两个正整数 A,B(1≤A,B≤10000)输出描述:共T行,每行一个结果...

2018-09-10 22:56:50 110

空空如也

空空如也

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

TA关注的人

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