摘要: 题目链接:P1102 解题思路: 要找A-B=C,变成A=B+C,将数排序,遍历每一个数,用二分查找查看是否存在B+C,因为不同位置数字算不同一对,所以要特殊处理,开数组记录的话可能会MLE,所以用map来存数字出现次数 AC代码: 1 #include <iostream> 2 #include 阅读全文
posted @ 2020-09-12 22:22 不敢说的梦 阅读(542) 评论(0) 推荐(0)
摘要: 题目链接:P3817 解题思路: 每次吃的时候,吃后面一个,前面已经满足条件了,只要更改后面的那个,就能一次使更多的盒子满足条件,第一个要特判,不然按照这个思路是有可能出现盒子里糖果数是负数的。 AC代码: 1 #include <iostream> 2 #include <cstdio> 3 #d 阅读全文
posted @ 2020-09-08 20:00 不敢说的梦 阅读(219) 评论(0) 推荐(0)
摘要: 题目链接:P1002 解题思路: 递推得到从A到B点的方法数,如果遇到控制点,则到达该点的方法数为0 AC代码: 1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 long long g[21][21]; 5 int 阅读全文
posted @ 2020-09-08 13:53 不敢说的梦 阅读(162) 评论(0) 推荐(0)
摘要: 题目链接: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 阅读全文
posted @ 2020-09-08 13:45 不敢说的梦 阅读(342) 评论(0) 推荐(0)
摘要: 题目链接:P1249 解题思路: 有两行输出,先找出乘积最大的那些数,然后用高精度计算乘积。 要想乘积最大,要尽可能使因数多,并且因数之间的差尽可能小,可以从2开始累加,当sum大于n时,把多出的部分取掉即可。 AC代码: 1 #include <cstdio> 2 #include <iostre 阅读全文
posted @ 2020-09-08 13:41 不敢说的梦 阅读(430) 评论(0) 推荐(0)
摘要: 题目链接:P1803 Describe: 现在各大 oj 上有 nnn 个比赛,每个比赛的开始、结束的时间点是知道的。 yyy 认为,参加越多的比赛,noip 就能考的越好(假的)。 所以,他想知道他最多能参加几个比赛。 由于 yyy 是蒟蒻,如果要参加一个比赛必须善始善终,而且不能同时参加 222 阅读全文
posted @ 2020-09-08 13:30 不敢说的梦 阅读(222) 评论(0) 推荐(0)
摘要: 题目链接: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: 阅读全文
posted @ 2020-09-04 09:38 不敢说的梦 阅读(296) 评论(0) 推荐(0)
摘要: 题目链接: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 阅读全文
posted @ 2020-09-02 22:35 不敢说的梦 阅读(204) 评论(0) 推荐(0)
摘要: 题目链接: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 阅读全文
posted @ 2020-09-02 15:44 不敢说的梦 阅读(69) 评论(0) 推荐(0)
摘要: 题目链接: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 阅读全文
posted @ 2020-09-02 09:06 不敢说的梦 阅读(151) 评论(0) 推荐(0)