[Codeforces-911B] - Two Cakes】的更多相关文章

题目:http://codeforces.com/contest/629/problem/D 题意:有n个蛋糕要叠起来,能叠起来的条件是蛋糕的下标比前面的大并且体积也比前面的大,问能叠成的最大体积 思路:DP[i]表示拿到第i个蛋糕时最多能叠成的体积,转移就是这样DP[i]=max(DP[1...i])+V[i];如果直接做的话复杂度是n^2的,用线段树维护比它小的蛋糕的能叠的最大体积,事先离散化, #include <cstdio> #include <cstring> #inc…
B. Two Cakes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sasha and Dima want to buy two nn -tier cakes. Each cake should consist of nn different tiers: from the size of 11 to the size o…
A. Carrot Cakes time limit per test   1 second memory limit per test   256 megabytes   In some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are ready at the same moment t minutes after they started baking. Arkady n…
B. Two Cakes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them in…
链接:https://codeforces.com/contest/1130/problem/B 题意: 给定n和 2 * n个数,表示i位置卖ai层蛋糕, 有两个人在1号,必须严格按照1-n的顺序买蛋糕,同时每个店只买一个蛋糕 . 求所需的最短时间. 思路: 将每种蛋糕对应位置记录在二维数组. 从1-n挨个买,根据上一次的位置算出消耗. 代码: #include <bits/stdc++.h> using namespace std; typedef long long LL; const…
[题目链接]:http://codeforces.com/contest/799/problem/A [题意] 你有一个烤炉; 每t秒能同时烤出k个蛋糕; 你可以在第一个烤炉在烤的时候;同时花费d秒建造另外一个相同的烤炉; 也是t秒烤出k个蛋糕; 问你是否造两个烤炉一起烤更快; [题解] 先算出一个烤炉要花多长时间; ((n-1)/k +1)*t 然后枚举时间i; 如果i是k的倍数,则tot+=k,如果(i-d)>0且(i-d)是k的倍数则tot也能递增k; 找到第一个tot大于等于n的i就好;…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 直觉题. 感觉情况会很少. 毕竟间隔太大了.中间肯定有一些数字达不到. 有1肯定可以 2 2 x肯定可以 3 3 3也可以 2 4 4也可以. 就这样 [代码] #include <bits/stdc++.h> using namespace std; vector <int> v; int main(){ #ifdef LOCAL_DEFINE freopen("rush_in.txt", &…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 从小到大枚举x. 看看a/x+b/x是不是大于等于n 是的话. 看看是不是两种蛋糕都能凑一堆. 也即x的最大枚举量是min(a,b) 不然可能有多余的a%x没地方放.(因为它都还没有一堆 [代码] #include <bits/stdc++.h> using namespace std; int n,a,b; int main(){ #ifdef LOCAL_DEFINE freopen("rush_in.txt&q…
D. The Bakery time limit per test:2.5 seconds memory limit per test:256 megabytes input:standard input output:standard output Some time ago Slastyona the Sweetmaid decided to open her own bakery! She bought required ingredients and a wonder-oven whic…
A. Carrot Cakes time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output In some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are ready at the same moment t minut…