09 2020 档案
摘要:题目链接:POJ 3190 Describe: Oh those picky N (1 <= N <= 50,000) cows! They are so picky that each one will only be milked over some precise time interval
阅读全文
摘要:题目链接:P2240 解题思路: 计算出每堆金币的单位价值(总价值除以总质量),然后每次尽可能取单位价值最大的。 AC代码: 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 using namespace std;
阅读全文
摘要:题目链接:P5019 解题思路: 得到差分数组,要想把路填平,则需要差分数组都变为0,则需要天数等于负数和的绝对值加上正数和减去负数和的绝对值(填负数时,正数和减少了),即为正数和,再加上数组首元素(保证把所有坑高度一样,且路填平了) AC代码: 1 #include <iostream> // 注
阅读全文
摘要:题目链接:P2678 解题思路: 如果可行解为单调,则可以用二分答案找到最终答案,对于选到的答案,去验证是否正确,最后确定所需解。 AC代码: 1 #include <cstdio> 2 #include <iostream> 3 #define ll long long 4 using names
阅读全文
摘要:题目链接:P1678 解题思路: 二分查找找到分差最小的,加起来即可,细节见代码注释 AC代码: 1 #include <iostream> 2 #include <cstdio> 3 #include <cmath> 4 #include <algorithm> 5 using namespace
阅读全文
摘要:题目链接:P1102 解题思路: 要找A-B=C,变成A=B+C,将数排序,遍历每一个数,用二分查找查看是否存在B+C,因为不同位置数字算不同一对,所以要特殊处理,开数组记录的话可能会MLE,所以用map来存数字出现次数 AC代码: 1 #include <iostream> 2 #include
阅读全文
摘要:题目链接:P3817 解题思路: 每次吃的时候,吃后面一个,前面已经满足条件了,只要更改后面的那个,就能一次使更多的盒子满足条件,第一个要特判,不然按照这个思路是有可能出现盒子里糖果数是负数的。 AC代码: 1 #include <iostream> 2 #include <cstdio> 3 #d
阅读全文
摘要:题目链接:P1002 解题思路: 递推得到从A到B点的方法数,如果遇到控制点,则到达该点的方法数为0 AC代码: 1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 long long g[21][21]; 5 int
阅读全文
摘要:题目链接:P1255 解题思路: 倒推,最后上楼梯的方法数等于f(n) = f(n-1) + f(n-2),用递推+高精 AC代码: 1 #include <iostream> 2 #define mx 1212 // 固定位数 3 using namespace std; 4 int a[5010
阅读全文
摘要:题目链接:P1249 解题思路: 有两行输出,先找出乘积最大的那些数,然后用高精度计算乘积。 要想乘积最大,要尽可能使因数多,并且因数之间的差尽可能小,可以从2开始累加,当sum大于n时,把多出的部分取掉即可。 AC代码: 1 #include <cstdio> 2 #include <iostre
阅读全文
摘要:题目链接:P1803 Describe: 现在各大 oj 上有 nnn 个比赛,每个比赛的开始、结束的时间点是知道的。 yyy 认为,参加越多的比赛,noip 就能考的越好(假的)。 所以,他想知道他最多能参加几个比赛。 由于 yyy 是蒟蒻,如果要参加一个比赛必须善始善终,而且不能同时参加 222
阅读全文
摘要:题目链接:P1923 Describe: 输入 nnn(n<5000000n<5000000n<5000000 且 nnn 为奇数) 个数字 ai(0<ai<109)a_i(0<a_i<10^9)ai(0<ai<109) ,输出这些数字的第 kkk 小的数。最小的数是第 0 小。 Input:
阅读全文
摘要:题目链接:POJ 3414 Describe: You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i) f
阅读全文
摘要:题目链接:POJ 3087: Describe: A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting w
阅读全文
摘要:题目链接:POJ 3126 Describe: The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to ch
阅读全文
摘要:题目链接:POJ 3278 Describe: Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0
阅读全文

浙公网安备 33010602011771号