题目链接: D. Gadgets for dollars and pounds time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Nura wants to buy k gadgets. She has only s burles for that. She can buy each gadget for dollars or…
D. Gadgets for dollars and pounds 题目连接: http://www.codeforces.com/contest/609/problem/C Description Nura wants to buy k gadgets. She has only s burles for that. She can buy each gadget for dollars or for pounds. So each gadget is selling only for som…
D. Gadgets for dollars and pounds time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Nura wants to buy k gadgets. She has only s burles for that. She can buy each gadget for dollars or for po…
D. Gadgets for dollars and pounds time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Nura wants to buy k gadgets. She has only s burles for that. She can buy each gadget for dollars or for po…
Nura wants to buy k gadgets. She has only sburles for that. She can buy each gadget for dollars or for pounds. So each gadget is selling only for some type of currency. The type of currency and the cost in that currency are not changing. Nura can buy…
二分天数+验证 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; +; int n,m,k; long long s; long long a[maxn],b[maxn],c[maxn]; int t[maxn]; long long A[maxn],B[maxn]; int preA[maxn],preB[maxn]; st…
对于这题笔者无解,只有手抄一份正解过来了: 基本思想就是 : 二分答案,对于第x天,计算它最少的花费f(x),<=s就是可行的,这是一个单调的函数,所以可以二分. 对于f(x)的计算,我用了nlog(n)的算法,遍历m个商品,用c[i]乘以前x天里,第t[i]种货币的最便宜的价格,存放到一个数组里,之后排序,计算前k个的和就是f(x) 前x天里,第t[i]种货币的最便宜的价格是通过预处理得到的,很容易的计算一下前缀最小值就行了. 贴代码吧: #include <iostream> #in…
传送门:http://codeforces.com/problemset/problem/609/D (如需转载,请注明出处,谢谢O(∩_∩)O) 题意: Nura想买k个小玩意,她手上有 s 个burles(一种货币),有m个小玩意供她选择购买,但每个小玩意只能用dollars或者pounds来购买,所以每次购买的时候Nura都要通过汇率将她手上的burles换成dollars或者pounds,而每一天的汇率又不一样,给出n天,并且这n天中burles换成dollars和pounds的比率,问…
Intervals 题目连接: http://codeforces.com/gym/100231/attachments Description 给你n个区间,告诉你每个区间内都有ci个数 然后你需要找一个最小的点集,使得满足这n个区间的条件 Input n 然后li,ri,ci Output 输出最小点集大小 Sample Input 5 3 7 3 8 10 3 6 8 1 1 3 1 10 11 1 Sample Output 6 Hint 题意 题解: 线段树+二分+贪心 首先我们贪心一…
地址:http://codeforces.com/problemset/problem/712/C 题目: C. Memory and De-Evolution time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Memory is now interested in the de-evolution of objects, sp…