走过的坑——C
Acuper
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Dragons https://www.bnuoj.com/v3/problem_show.php?pid=26407
问:两个数组x[i]和y[i]一一对应,用sort给x[i]排序后x[i]和y[i]不对应了,怎么办 答:用struct,然后sort自定义比较方式 本题为贪心原创 2016-07-09 17:20:40 · 2745 阅读 · 0 评论 -
二分+dp,在一个地方上卡了2小时
https://www.bnuoj.com/v3/contest_show.php?cid=8095#problem/A 以为所以的dp[i]+n-i一定是dp[n]最小,但并不是 正确代码: #include #include #include #include using namespace std; typedef long long LL; const int N = 20原创 2016-07-29 21:53:23 · 792 阅读 · 0 评论 -
2016青岛online——I count two three
传送门 题意:输入n,求出能分解为2^a*3^b*5^c*7^d的大于n的最小数 基本思路:打表写出所有能分解为2^a*3^b*5^c*7^d的数,然后二分查找,lower_bound 复杂度:32*21*13*11 一开始不会的原因:想到要打表,但是不知道怎么入手,有多少个数,做题少 解决:2:0~31;3:0~20;5:0~12;7:0~10.最多32*21*13*11个,实际上远少原创 2016-09-17 16:19:07 · 562 阅读 · 0 评论 -
高精度除法
搞了一下午,弄懂了一个高精度除法 传送门:http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1001&cid=719 坑点:关系运算法的优先级比赋值运算符高,少了一个括号,调试了半个小时 还有一个本来是 #include #include #include #include #include #include using原创 2016-08-14 21:49:22 · 524 阅读 · 0 评论 -
Sereja and Swaps
Sereja and Swaps 题目大意:给出一个长度为n的序列,以及可以交换的次数k,可以在原先的序列中任意交换两个数,然后要求找到一个连续的子序列和最大,输出最大值。 解题思路;枚举区间,o(n^2),然后将区间内最小的数逐个和区间外面最大的数交换。 在一个地方坑了好长时间:while(k--),k每次循环都是上次循环的数,所以应该int cnt=k;while(cnt--原创 2016-08-26 12:34:56 · 549 阅读 · 0 评论 -
getchar()啥时候用
#include #include #include #include #include #include const int maxn=13; 要用getchar: int main() { int t; scanf("%d",&t); char str[13]; gets(str); // scanf("%s",str); puts(str); return原创 2016-08-15 13:52:27 · 878 阅读 · 0 评论 -
优先级队列
坑点:某些区间,out优先级队列会为空,这是不能出现out.top(),否则会出错 https://www.bnuoj.com/v3/problem_show.php?pid=35125 用优先级队列,实现每次都是in中的最小值和out中的最大值比较,而且交换后in马上重新排序,out:pop后不用push,因为push的数肯定不要再和in中的交换 #include #include #原创 2016-10-01 19:30:24 · 669 阅读 · 0 评论
分享