自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 POJ 3104:greedy algorithms

3104 (greed): Happy algorithmsMeaning:There are n freshly washed clothes, each given a moisture content. There is a dryer. You can choose a piece of clothes to dry every minute, and you can dry k the water every minute. Each garment can automatically ev

2021-10-11 08:12:28 158 1

原创 POJ3085:Greedy algorithm

This is an introductory example of greedy algorithm, which also introduces greedy algorithm.Introduction to greedy algorithm:(1) Greedy algorithms always make the best choice at present. That is to say, greedy algorithm is not considered from the overal

2021-09-06 12:41:26 173 2

原创 POJ 1218: Method of simulation

1)Problem overviewA prison warden was drunk and opened every door of the prison (suppose there were n doors); Then start from door 1 and close one door every other (close the door with multiple of 2); Then start from door 1 and operate one door every two

2021-08-16 11:29:34 181 2

原创 POJ 3369: pruning calculations

Theme:The grocery store clerk can’t distinguish the symbols of addition and multiplication, so they expect to buy the same products.Requirements, output all four numbers a, B, C, D, meet a + B + C + D = = a * b * c * d < = 20, a, B, C, D requires 2 ..

2021-03-14 14:07:19 223 8

原创 POJ 3331: Factorial Calculation (High Precision Problem)

Overview:Give two numbers n, m, M is 0 to 9, ask n! How many m in the result;Input: (1) t: number of test cases; (2) n, m, total T lines;Output: n! Contains the number of M, a total of T lines.Solution:There are several procedures:Recursion is ..

2021-03-12 12:41:18 171 4

原创 Analysis for POJ 3356: DP algorithm

Question meaning: What is the least steps it takes for you changing a string to another string, provided that you can either add, delete, or change.DP algorithm:a) dp[i][j] is the least steps it take to transform the first i parts in the first string..

2020-12-15 18:31:11 146 1

原创 Analysis for poj3325

Analysis for Problem 3325 on poj.orgQuestion meaning: given n numbers, isolate the smallest and largest numbers. Since the number of largest numbers is greater or equal to 1, truncate one largest number. This is also same for those smallest numbers. Aft

2020-12-04 21:51:14 125 1

原创 Analysis for POJ 3302

Analysis for POJ 3302Problem meaning:Give two strings S1 and S2 to judge whether S2 or the reverse string of S2 is a substring of S1. From the example, the substring does not need to be continuous in S1, as long as the sequence is right.Input: (1) integ

2020-12-02 19:18:43 126 1

原创 POJ 3292 Analysis: lists and table method

The meaning of this problem: define H number, which remains 1 when divides 4, such as 5,9,13,17……; define H prime, which can be only divided itself and 1; define Semi-prime H-number, which divides a H prime to be another H prime. How many Semi-prime H-num.

2020-11-11 21:16:22 169 1

原创 DP algorithm to solve problem 3014 on poj.org by C++

For this problem, there are 3 ways to solve, two DP algorithms to solve and one mathematical way to solve.Question meaning:Put m pieces of cakes into n plates, a plate can have 0 or multiple pieces of cakes, how many ways are there?(for more sp..

2020-06-27 09:52:05 836 2

原创 DP algorithm: POJ 3046

Question meaning: There are T kinds of ants, every kind has a specific amount, in total there are A amount of ants. The value of variables S and B are given, ask how many combinations are there to form s, s+1,…,B amount of ants using T kinds of A amount ..

2020-05-14 09:16:18 239 1

原创 POJ3021 e-coins: difference between DP solution and normal solution

POJ 3021 e-coins: difference between DP algorithm and conventional methodOne、 Different solutions1, DP thinking(1) The method of DP is an exhaustive method;(2) DP is constantly dynamic programming...

2020-03-28 12:05:48 265 2

原创 POJ 3021 Analysis: DP algorithm

Problem SolvingThere are now two currencies, M-group, each with a traditional currency and an IT currency. We are going to change these two currencies into a new one. The exchange method is that the...

2020-03-28 03:00:12 197 1

原创 Analysis for poj 3021

1、 Title(1) Currency has traditional value and IT value. When it is converted into new currency, the sum of the squares of traditional value and IT value is equal to the sum of the squares of new cur...

2020-03-27 03:23:44 312 1

原创 poj3210: the gain of very easy problem

Is this the easiest problem in poj? Enter a number, even numbers have no solution, odd numbers are reduced by one output.Intention:Snoopy has n coins. After x flips, all coins can be front or back f...

2019-08-31 10:34:59 168 1

原创 poj3210: the gain of very easy problem

Is this the easiet problem in poj? Enter a number, even numbers have no solution, odd numbers are reduced by one output.Intention:Snoopy has n coins. After x flips, all coins can be front or back fa...

2019-08-31 09:21:57 434 2

原创 poj3253 优先队列( poj的bug)

8月1日的题32533253 Fence Repair(贪心、优先队列)(这道题看后面的算法思路)题意:有一位农夫需要n块给定长度的木头,去借锯子时的要求是,每锯下一块,就要付出这块木头长度的费用,求最小费用。输入:(1)n;(2)n块木头的长度;输出:最小费用。思路:1、基本思路:(1)显然要锯n次,也就是找一个最好的锯的顺序;(2)从原题hint中看到,有一个隐含的要求是首先...

2019-08-24 11:02:18 295 1

原创 poj 3044 和 3250 栈的使用

poj 3044:3044(贪心,单调栈)与3250一起做。这道题主要是题意难懂,看详细的分析。题意:以坐标的形式给出一张图,表示一些楼房的正视图,求出楼房的最少个数。题意理解:(1)给出的坐标是高度发生变化时的楼高坐标,上面的例图中,一个宽度为27的楼面正视图其实用10个发生高度变化时的坐标就能决定,如下:x=1时,楼高y=1;x=2-4,y=2;x=5时,y=1;x=6-7时,y...

2019-07-31 20:10:15 209 1

原创 poj 3232 和 3104:二分逼近

3232 Accelerator(二分逼近)二分法的总体思路就是,(1)以二分的方法确定一个值,假定这个值就是答案,(2)判断这个值是大还是小,并在相应半区重新估值,再判断;(3)以半区区间的左边界left不再比右边界小为结束条件。(有一点贪心的思路在里面,这个最短的时间内,显然所有加速器都在被使用,这样才会时间最短)(这就要求,要事先知道判断方法:一个值是偏大还是偏小,如果知道了判断方法,就能...

2019-06-30 17:46:22 246 3

原创 poj 3146: Lucas 定理

一、常规方法见poj 3219的方法,这一方法容易理解,只是超时。对于输入的n、p,for(i=0;i<=n;i++){用前面的方法,分别计算n!、i!、(n-i)!中因子p的个数,再比较n!中因子p的个数与i!、(n-i)!中因子p的个数之和,来决定组合数C(n,i)是否能整除p;如不能整除,计数器加1;}代码如下:#include using namespace st...

2019-06-16 17:41:51 190 1

原创 poj 3219 解析: 求阶乘中某质因子个数的方法

一、求阶乘中某质因子个数的方法求一个阶乘数中某因子的个数,常用的方法如下:(扩展,lucas定理是关于组合数模一个质因子p后的余数)先看懂例子:9!中含有多少个29! = 9×8×7×6×5×4×3×2×1= (8×6×4×2)×9×7×5×3×1,后面的9×7×5×3×1就是other;= 2^4×(4×3×2×1)×other,2的倍数的4个数每个分出一个2来,就是 2^k×k!×o...

2019-06-16 09:14:19 1035 2

原创 poj 3125解析

(1)这道题只有一个对象:打印作业这个对象有两个属性:1.优先级 2.是不是自己的作业(2) 我们要解决的问题是自己作业第几分钟被打印我们把队首的数拿出来,如果队首的作业优先级最大,则打印,不然,排到队尾去。我们得重点标注出自己的数;我们还得打擂台,判断队首的数是否是最大的数;我们还得处理打印完一个作业后,如何处理剩下的数核心步骤:如何重点标注出自己的优先级:用个布尔变量,设自己的...

2019-04-22 06:59:08 318 1

原创 4月21日,我开始了CSDN生涯

你好,这是一个尝试欢迎使用Markdown编辑器你好! 这是你第一次使用 Markdown编辑器 所展示的欢迎页。如果你想学习如何使用Markdown编辑器, 可以仔细阅读这篇文章,了解一下Markdown的基本语法知识。新的改变我们对Markdown编辑器进行了一些功能拓展与语法支持,除了标准的Markdown编辑器功能,我们增加了如下几点新功能,帮助你用它写博客:全新的界面设计 ,...

2019-04-21 20:58:59 190 3

空空如也

空空如也

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

TA关注的人

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