HDU
文章平均质量分 68
杭电OJ题解与分析,HDU 题号 题目标题 标签 难度
memcpy0
希望探索文理结合的自由之路。
展开
-
HDU 3342 Legal or Not【Graph/Topological Sort】
Problem DescriptionACM-DIY is a large QQ group where many excellent acmers get together. It is so harmonious that just like a big family. Every day,many “holy cows” like HH, hh, AC, ZT, lcc, BF, Qinz and so on chat on-line to exchange their ideas. When so原创 2021-03-15 00:30:33 · 159 阅读 · 0 评论 -
HDU 1285 确定比赛名次【Graph/Topological Sort】
Problem Description有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。Input输入有若干组,每组中的第一行为二个数N(1<=N<=500),M;其中N表示队伍的个数,M表示接着有M行的输入数据。接下来的M行数据中,每行也有两个整数原创 2021-03-15 00:18:39 · 161 阅读 · 0 评论 -
HDU 1166 敌兵布阵【树状数组】
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以Tidy要随时向Derek汇报某一段连续的工兵营地一共有多少人,例如De原创 2020-09-04 01:23:20 · 152 阅读 · 0 评论 -
HDU 2648 Shopping【映射/字符串哈希】
Problem DescriptionEvery 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原创 2020-09-01 17:57:17 · 233 阅读 · 0 评论 -
HDU 4825 Xor Sum【01字典树/贪心】(两数最大/最小异或和)
Problem DescriptionZeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了 N 个正整数,随后 Prometheus 将向 Zeus 发起M 次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异或结果最大。Prometheus 为了让 Zeus 看到人类的伟大,随即同意 Zeus 可以向人类求助。你能证明人类的智慧么?Input输入包含若干组测试数据,每组测试数据包含若原创 2020-08-31 13:48:46 · 252 阅读 · 0 评论 -
HDU 3336 Count the string【KMP的next数组性质】
题目链接:HDU 3336 Count the stringProblem DescriptionIt is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s , we can write down all the non-empty prefixes of this string.For example: s: "abab". T原创 2020-08-31 00:26:37 · 163 阅读 · 0 评论 -
HDU 1711 Number Sequence【字符串】
Problem DescriptionGiven 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原创 2020-08-27 01:02:57 · 154 阅读 · 0 评论 -
HDU 1686 Oulipo【String/KMP】
Problem DescriptionThe 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 norm原创 2020-08-26 22:55:20 · 179 阅读 · 0 评论 -
HDU 2087 剪花布条【KMP】
Problem Description一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过 1000 个字符长。如果遇见 # 字符,则不再进行工作。Output输出能从花纹布中剪出的最多小饰条个数,如果一块都没有,那就老老实实输出 0原创 2020-08-26 18:51:42 · 186 阅读 · 0 评论 -
HDU How Many Tables【并查集】
Problem DescriptionToday is Ignatius’ birthday. He invites a lot of friends. Now it’s dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, and all the friends do not want to s原创 2020-06-08 20:52:37 · 229 阅读 · 0 评论 -
【排列】HDU1027 Ignatius and the Princess II
Problem DescriptionNow our hero finds the door to the BEelzebub feng5166. He opens the door and finds feng5166 is about to kill our pretty Princess. But now the BEelzebub has to beat our hero first...原创 2019-09-22 16:39:48 · 222 阅读 · 0 评论 -
HDU1062 Text Reverse【字符串】
HDU1062 Text ReverseProblem DescriptionIgnatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them....原创 2019-09-12 23:56:31 · 234 阅读 · 0 评论 -
HDU 1251 统计难题【Trie】
HDU和PAT,很多时候都还需要使用C风格的字符串和输入输出函数,有点麻烦…Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给I...原创 2019-11-24 00:51:33 · 239 阅读 · 0 评论 -
【约瑟夫环】HDU 1276 士兵队列训练问题
Problem Description某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从头开始进行一至三报数,凡报到三的出列,剩下的向小序号方向靠拢,继续从头开始进行一至二报数。。。,以后从头开始轮流进行一至二报数、一至三报数直到剩下的人数不超过三人为止。Input本题有多个测试数据组,第一行...原创 2020-02-14 23:39:24 · 425 阅读 · 0 评论 -
HDU 1362 Red and Black【BFS/DFS】
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 33879 Accepted Submission(s): 20528Problem DescriptionThere is a rectangular room, cover...原创 2020-02-23 16:33:32 · 217 阅读 · 0 评论 -
HDU1702题解
ACboy needs your help again!Problem DescriptionACboy was kidnapped!!he miss his mother very much and is very scare now.You can’t image how dark the room he was put into is, so poor ????.As a smart AC...原创 2019-09-16 00:47:33 · 424 阅读 · 0 评论 -
【排列】HDU1716 排列2
Problem DescriptionRay又对数字的列产生了兴趣:现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。Input每组数据占一行,代表四张卡片上的数字(0<=数字<=9),如果四张卡片都是0,则输入结束。Output对每组卡片按从小到大的顺序输出所有能由这四张卡片组成的4位数,千位数字相同的在同一行,同一行中每个四位数间...原创 2019-09-22 17:17:24 · 247 阅读 · 0 评论 -
【优先队列】HDU1873 看病要排队
hdu1873 看病要排队Problem Description看病要排队这个是地球人都知道的常识。不过经过细心的0068的观察,他发现了医院里排队还是有讲究的。0068所去的医院有三个医生(汗,这么少)同时看病。而看病的人病情有轻重,所以不能根据简单的先来先服务的原则。所以医院对每种病情规定了10种不同的优先级。级别为10的优先权最高,级别为1的优先权最低。医生在看病时,则会在他的队伍里...原创 2019-09-22 12:08:43 · 282 阅读 · 0 评论 -
HDU1090-HDU1099题解
文章目录A+B for Input-Output Practice (II)这都是些输入输出的练习。A+B for Input-Output Practice (II)#include <cstdio>int main() { int n; scanf("%d", &n); while (n--) { int a, b; scanf("%d%d", &a...原创 2019-09-12 21:16:15 · 354 阅读 · 0 评论 -
HDU2011-2020题解
文章目录2011 多项式求和2012 素数判定2013 蟠桃记2014 青年歌手大奖赛_评委会打分2015 偶数求和2016 数据的交换输出2017 字符串统计(递推) 2018 母牛的故事2019 数列有序!2020 绝对值排序2011 多项式求和好像是做过的简单题。#include <cstdio>int main() { int m, n; scanf("%d", &...原创 2019-09-10 19:52:59 · 329 阅读 · 0 评论 -
HDU2031-2040题解
文章目录2033 人见人爱A+B2034 人见人爱A-B(快速幂+取余) 2035 人见人爱A^B2036 改革春风吹满地2039 三角形2033 人见人爱A+B#include <cstdio>const int hour = 3600, minu = 60;int main() { int n, ah, am, as, bh, bm, bs; scanf("%d"...原创 2019-09-12 21:16:35 · 410 阅读 · 0 评论 -
HDU2021-2030题解
文章目录(贪心) 2021 发工资咯:)2022 海选女主角2023 求平均成绩2024 C语言合法标识符2025 查找最大元素2026 首字母变大写2027 统计元音2028 Lowest Common Multiple Plus2029 Palindromes _easy version(汉字编码) 2030 汉字统计(贪心) 2021 发工资咯:)Problem Description...原创 2019-09-10 23:44:53 · 350 阅读 · 0 评论 -
【拓扑排序/判断树根】HDU2094 产生冠军
Problem Description有一群人,打乒乓球比赛,两两捉对撕杀,每两个人之间最多打一场比赛。球赛的规则如下:如果A打败了B,B又打败了C,而A与C之间没有进行过比赛,那么就认定,A一定能打败C。如果A打败了B,B又打败了C,而且,C又打败了A,那么A、B、C三者都不可能成为冠军。根据这个规则,无需循环较量,或许就能确定冠军。你的任务就是面对一群比赛选手,在经过了若干场撕杀...原创 2019-09-22 17:41:12 · 196 阅读 · 0 评论 -
【Ad Hoc】HDU2648 Shopping
Problem DescriptionEvery 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 “...原创 2019-09-22 17:44:58 · 211 阅读 · 0 评论 -
【BFS】HDU 2717 Catch That Cow
Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 28651 Accepted Submission(s): 7845Problem DescriptionFarmer John has been informed of the...原创 2020-03-02 00:57:42 · 193 阅读 · 0 评论 -
【约瑟夫环】HDU 4841 “圆桌问题"
Problem Description圆桌上围坐着2n个人。其中n个人是好人,另外n个人是坏人。如果从第一个人开始数数,数到第m个人,则立即处死该人;然后从被处死的人之后开始数数,再将数到的第m个人处死……依此方法不断处死围坐在圆桌上的人。试问预先应如何安排这些好人与坏人的座位,能使得在处死n个人之后,圆桌上围坐的剩余的n个人全是好人。Input多组数据,每组数据输入:好人和坏人的人数n...原创 2019-09-12 23:20:02 · 620 阅读 · 0 评论 -
HDU2041-2050题解
文章目录2043 密码2043 密码#include <cstdio>#include <string>#include <iostream>#include <cctype>using namespace std;int main() { int n; scanf("%d", &n); string s; while ...原创 2019-09-12 21:16:49 · 224 阅读 · 0 评论 -
HDU2051-2060题解
文章目录2054 A == B ?2054 A == B ?Problem DescriptionGive you two numbers A and B, if A is equal to B, you should print “YES”, or print “NO”.Inputeach test case contains two numbers A and B.Output...原创 2019-09-12 21:17:22 · 217 阅读 · 0 评论 -
HDU2071-2080题解
HDU入门100题题解原创 2019-09-12 21:18:01 · 240 阅读 · 0 评论 -
HDU2091-2100题解
文章目录2096 小明A+B2096 小明A+B#include <cstdio>int main() { int n, a, b; scanf("%d", &n); while (n--) { scanf("%d%d", &a, &b); a %= 100, b %= 100; if ((a == 35 && b ==...原创 2019-09-12 21:18:17 · 184 阅读 · 0 评论 -
HDU杂题(Ad Hoc)一览
3233 Download ManagerProblem DescriptionJiajia downloads a lot, a lot more than you can even imagine. Some say that he starts downloading up to 20,000 files together. If 20,000 files try to share ...原创 2019-09-12 22:32:37 · 285 阅读 · 0 评论 -
HDU2001-2010题解
HDU入门100题的题解原创 2019-09-10 17:28:57 · 318 阅读 · 0 评论