- 博客(6)
- 收藏
- 关注
原创 I. Shopping Spree
ou've won a shopping spree with a very peculiar rule. The items you are allowed to take are in consecutive order, indexed 1 through n. You may select any subset of these items subject to the following constraint:For each index k of items chosen for the s
2020-06-03 17:23:36 192
原创 E. Chain Email
woc:关同步流就不能用scanf和printf了A chain email is an email that people receive and then forward to all of their friends. This sort of email is very common amongst elderly people, who have notably bad memories. Elderly people’s memories are so bad that if they ..
2020-06-02 23:08:43 965
原创 J. Factorial Products(比较double类型数据的大小)
这个题注意一下:double类型的数据不能直接比较大小,或则判断是否相等,需要一个eps来间接判断一下。 if(a>eps+b) //用来判断按是否大于b eps通常为1e-6 if(fabs(a-b)<eps) //用来判断是a和b是否相等 思路:利用对数的性质来写,log(1*2*3*.....n)=log(n!)=log1 +log 2+log3 +...........+logncode:#include<bits/stdc++.h...
2020-06-02 22:56:55 126
原创 飞行路线(分层最短路模板)
题目连接:https://ac.nowcoder.com/acm/problem/20131思路:建立原图的基础上再建立k个分身,每个分身之间的权值为0,用dijkstra算起始点到各点的距离,注意k次免费的机会不一定都使用。画个图大家就明白了。...
2020-06-01 22:24:04 281
原创 spfa算法(优化版)
解决问题的范围:存在负边权的最短路问题时间复杂度:O(km)m是边的条数k是常数,算法是效率还算是比较高的,这个算法的时间复杂度的最坏是O(n*m)因此当没有负权的时候还是用dijkstra吧它和dijkstra的不同点在于spfa的标记数组是标记是否还在队列中(注意这个)算法的过程:加入初始的点,一般都是1,放入队列中,取队列的队首元素,遍历与队首元素相邻的点,如果距离变短则更新这个最短的值,如果这个点不在队列中就加入队列,如果在队列中就不用处理代码中由注释:给...
2020-06-01 17:09:44 310
原创 单词数(HDU2072)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=2072 单词数 Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 90181Accepted Submission(s): 23113 Problem Description lily的好朋友xiao...
2020-06-01 15:50:35 159
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人