![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
HDUOJ
文章平均质量分 77
📚HDUOJ[刷题记录] C++实现🍭🍭🍭
心一QAQ
总是学不会,再聪明一点!
展开
-
hduoj5248 序列变换 (二分答案 | 贪心)
序列变换Problem Description给定序列A=A1,A2,...,AnA={A1,A2,...,An}A=A1,A2,...,An, 要求改变序列A中的某些元素,形成一个严格单调的序列B(严格单调的定义为:Bi<Bi+1,1≤i<N)Bi<B_{i+1},1≤i<N)Bi<Bi+1,1≤i<N)。我们定义从序列A到序列B变换的代价为cost(A,B)=max(∣Ai−Bi∣)(1≤i≤N)。cost(A,B)=max(|Ai−Bi|)(1≤i≤N)。c原创 2021-02-27 19:58:03 · 270 阅读 · 0 评论 -
hduoj1002 A + B Problem II (大数相加 字符串模拟)
hduoj1559 最大子矩阵Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1<=T<=20) which means the number of test case原创 2020-12-31 19:39:20 · 150 阅读 · 0 评论 -
hduoj1559 最大子矩阵(二维前缀和)
hduoj1559 最大子矩阵Problem Description给你一个m×n的整数矩阵,在上面找一个x×y的子矩阵,使子矩阵中所有元素的和最大。Input输入数据的第一行为一个正整数T,表示有T组测试数据。每一组测试数据的第一行为四个正整数m,n,x,y(0<m,n<1000 AND 0<x<=m AND 0<y<=n),表示给定的矩形有m行n列。接下来这个矩阵,有m行,每行有n个不大于1000的正整数。Output对于每组数据,输出一个整数原创 2020-12-04 11:51:23 · 261 阅读 · 0 评论 -
hduoj2048 神、上帝以及老天爷 (错排问题 详细推导)
hduoj2048 神、上帝以及老天爷Problem DescriptionHDU 2006’10 ACM contest的颁奖晚会隆重开始了!为了活跃气氛,组织者举行了一个别开生面、奖品丰厚的抽奖活动,这个活动的具体要求是这样的:首先,所有参加晚会的人员都将一张写有自己名字的字条放入抽奖箱中;然后,待所有字条加入完毕,每人从箱中取一个字条;最后,如果取得的字条上写的就是自己的名字,那么“恭喜你,中奖了!”大家可以想象一下当时的气氛之热烈,毕竟中奖者的奖品是大家梦寐以求的Twins签名照呀原创 2020-11-19 22:48:50 · 146 阅读 · 0 评论 -
hduoj5479 Scaena Felix
hduoj5479 Scaena FelixProblem DescriptionGiven a parentheses sequence consist of ‘(’ and ‘)’, a modify can filp a parentheses, changing ‘(’ to ‘)’ or ‘)’ to ‘(’.If we want every not empty substring of this parentheses sequence not to be “paren-matching原创 2020-11-10 15:45:43 · 94 阅读 · 0 评论 -
hduoj1053 Entropy (Huffman Coding + priority_queue)
hduoj1053 EntropyProblem DescriptionAn entropy encoder is a data encoding method that achieves lossless data compression by encoding a message with “wasted” or “extra” information removed. In other words, entropy encoding removes information that was no原创 2020-11-06 19:50:34 · 115 阅读 · 0 评论 -
hduoj1556 Color the ball (差分标记+前缀和)
hduoj1556 Color the ballProblem DescriptionN个气球排成一排,从左到右依次编号为1,2,3…N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗?Input每个测试实例第一行为一个整数N,(N <= 100000).接下来的N行,每行包括2个整数a b(1 <= a原创 2020-11-06 17:37:24 · 148 阅读 · 0 评论 -
hduoj2527 Safe Or Unsafe (Huffman Coding + priority_queue)
Problem DescriptionJavac++ 一天在看计算机的书籍的时候,看到了一个有趣的东西!每一串字符都可以被编码成一些数字来储存信息,但是不同的编码方式得到的储存空间是不一样的!并且当储存空间大于一定的值的时候是不安全的!所以Javac++ 就想是否有一种方式是可以得到字符编码最小的空间值!显然这是可以的,因为书上有这一块内容–哈夫曼编码(Huffman Coding);一个字母的权值等于该字母在字符串中出现的频率。所以Javac++ 想让你帮忙,给你安全数值和一串字符串,并让你判断这个字原创 2020-11-05 16:10:00 · 70 阅读 · 0 评论 -
hduoj6318 Swaps and Inversions (归并排序求逆序对)
Problem DescriptionLong long ago, there was an integer sequence a.Tonyfang think this sequence is messy, so he will count the number of inversions in this sequence. Because he is angry, you will have to pay x yuan for every inversion in the sequence.Yo原创 2020-10-20 11:00:50 · 82 阅读 · 0 评论 -
hduoj4911 Inversion (离散化+树状数组)
Problem Descriptionbobo has a sequence a1,a2,…,an. He is allowed to swap two adjacent numbers for no more than k times.Find the minimum number of inversions after his swaps.Note: The number of inversions is the number of pair (i,j) where 1≤i<j≤n and原创 2020-10-19 20:58:43 · 88 阅读 · 0 评论 -
hduoj 5327 Olympiad (一维前缀和)
Problem DescriptionYou are one of the competitors of the Olympiad in numbers. The problem of this year relates to beatiful numbers. One integer is called beautiful if and only if all of its digitals are different (i.e. 12345 is beautiful, 11 is not beaut原创 2020-10-18 20:37:13 · 120 阅读 · 0 评论 -
hduoj 5616 Jam‘s balance (二进制枚举)
Problem DescriptionJim has a balance and N weights. (1≤N≤20)The balance can only tell whether things on different side are the same weight.Weights can be put on left side or right side arbitrarily.Please tell whether the balance can measure an object原创 2020-10-13 20:07:36 · 184 阅读 · 0 评论