摘要: #include #include #include #include #include #include using namespace std;const int MAX_P = 1e6 + 10; int P;int a[MAX_P];void solve(){... 阅读全文
posted @ 2017-08-24 19:47 mofushaohua 阅读(85) 评论(0) 推荐(0)
摘要: #include #include using namespace std;const int MAX_N = 1e5 + 10;const int INF = 0x3f3f3f3f;int N, M;int x[MAX_N];bool C (int d){ int ... 阅读全文
posted @ 2017-08-24 19:46 mofushaohua 阅读(109) 评论(0) 推荐(0)
摘要: /* 注意这题比较特殊,求每条绳子的长度的时候,不会去四舍五入,确切说,是只会四舍,绝不五入...否则的话,最终还是不能达到K条的总数 这题对数据的处理要比较敏感,必须意识到,哪怕是保留两位小数,第三位小数,也是向下取整,绝对不可进位 想明白这点以后,cma... 阅读全文
posted @ 2017-08-24 19:45 mofushaohua 阅读(143) 评论(0) 推荐(0)
摘要: /* 这次去查了一下,为什么大家要那样设置INF,有了些新发现 http://blog.csdn.net/jiange_zh/article/details/50198097 以及,这题的思路来自挑战,这个思路真是极其巧妙,将奶牛之间的最短距离、最长距离都转... 阅读全文
posted @ 2017-08-24 19:44 mofushaohua 阅读(137) 评论(0) 推荐(0)
摘要: /*其实这题并不难,主要是我没有理解题意,题意就是找到一个A和一个B,A和B的绝对值不超过500,使得给出的 2n 个点,刚好一半在直线上,一半在直线上此外,当时没想到直接枚举,后来看了题解,仔细想想,这题的数据量好像真的不大,枚举确实是挺好的方法...当时怎么就不尝... 阅读全文
posted @ 2017-08-24 19:43 mofushaohua 阅读(412) 评论(0) 推荐(0)
摘要: /*这题有几个地方需要注意: 解析见挑战P75-76 思路:每次算出到达下一个加油站的距离d(将终点视为距离起点L,油量为0的加油站),从优先队列中,不断取油直到能够抵达这个距离d,并更新取油次数。如果还没到达d之前,队列却已经为空,则说明无法到达终点;到达d以后... 阅读全文
posted @ 2017-08-24 19:42 mofushaohua 阅读(161) 评论(0) 推荐(0)
摘要: //贪心#include #include using namespace std;int N, R;const int MAX_N = 1005;int X[MAX_N];void solve(){ sort(X, X + N); int i = 0, ans ... 阅读全文
posted @ 2017-08-24 19:40 mofushaohua 阅读(114) 评论(0) 推荐(0)
摘要: /*比较需要注意的是这句话* Every line (except perhaps the last one) contains the initials of 80 cows ('A'..'Z') in the new line. 没有特殊处理格式的话,就很容易... 阅读全文
posted @ 2017-08-24 19:40 mofushaohua 阅读(106) 评论(0) 推荐(0)
摘要: //这题的思路十分巧妙,两只蚂蚁同时反方向走,因为所有蚂蚁速度一致,可以看作是没有反向,而是继续按原方向走,直到下落...相当于将每只蚂蚁看作是独立运动的(挑战P20)#include using namespace std;const int N = 1e6 + 1... 阅读全文
posted @ 2017-08-24 19:39 mofushaohua 阅读(149) 评论(0) 推荐(0)
摘要: //可谓是非常水的题了,没什么可说的#include using namespace std;int main(){ int k, r; while (cin >> k >> r) { int i = 1; for (i = 1; ;i++) { int t... 阅读全文
posted @ 2017-08-24 19:38 mofushaohua 阅读(194) 评论(0) 推荐(0)