CodeForces 625A Guest From the Past】的更多相关文章

贪心水题 #include <stdio.h> #include <algorithm> #include <string.h> #include <queue> #include <stack> #include <map> #include <vector> using namespace std; long long ans; long long n,a,b,c; int main() { scanf("%…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probab…
题 题意 一升奶可以花费a元,也可以话b元买然后获得c元,一开始有n元,求最多买多少升奶. 分析 贪心,如果b-c<a,且n≥b,那就买b元的,n先减去b再看看够买多少瓶,然后再+1瓶,余款再购买a元的. 代码 #include<cstdio> unsigned long long n,a,b,c,ans; int main(){ scanf("%lld%lld%lld%lld",&n,&a,&b,&c); if(b-c<a &a…
题意是说一个人喝酒 有两种办法 买塑料瓶的 a块钱 喝了就没了 或者是买玻璃瓶的b块钱 喝完还能卖了瓶子c块钱 求最多能喝多少瓶 在开始判断一次 a与b-c的关系 即两种方式喝酒的成本 如果a<=b-c 那么直接全部买塑料瓶就行了 没必要买玻璃瓶 因为麻烦 而且会出现钱不够b却够b-c这种情况 很麻烦 如果a>b-c  也就是说买玻璃瓶更省一些 就应当先买玻璃瓶的 不行了再尝试塑料瓶 第一种情况只做一次除法就够了 第二种情况 如果用while循环(n>b)来做 会超时在test48...…
A. Guest From the Past 题目连接: http://www.codeforces.com/contest/625/problem/A Description Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found hi…
传送门 Description Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much more complicated. Koly…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably k…
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a3-+ai,问满足Si<=p的i的最大值的期望.(p<=50) (大意来自于http://www.cnblogs.com/liu-runda/p/6253569.html) 我们知道,全排列其实等价于我们一个一个地等概率地向一个序列里面插入数值 所以我们可以这么看这道题: 现在有n个数,有n个盒子…
D. Happy Tree Party Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/593/problem/D Description Bogdan has a birthday today and mom gave him a tree consisting of n vertecies. For every edge of the tree i, some number xi was w…
E. Ever-Hungry Krakozyabra time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Recently, a wild Krakozyabra appeared at Jelly Castle. It is, truth to be said, always eager to have something for…