ZOJ 3948 - Marjar Cola】的更多相关文章

题目链接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3948 题意 用 x 个 瓶身 可以 换 一瓶饮料 用 y 个 瓶盖 可以换 一瓶饮料 然后 换得一瓶饮料后 又可以得到 一个瓶盖 和 一个瓶身 然后 给出 刚开始 a 个 瓶身 和 b 个瓶盖 求最后 最多可以换得 多少饮料 如果 可以一直换下去 输出 INF 思路 我们只要 一轮一轮的 模拟换下去 然后 到达一个 阈值 就输出 INF 否则 输出 答案就可以了…
让我回想起了小学的时候,空瓶换饮料还能向别人借一个空瓶喝了再还回去的神奇问题…… 开始时思考,特判一下a=1或者b=1的情况为INF就可以了,然后发现2 2 1 2这样的样例也是能够喝到无穷多瓶饮料的. 所以干脆直接做循环,每次循环模拟换了饮料然后喝掉的情形,如果发现喝完空瓶子不减少或者瓶盖子不减少,那显然是能喝不知道多少瓶饮料了,就直接输出INF. #include<cstdio> int x,y,a,b,cnt; bool flag; int main() { int t; scanf(&…
地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3959 题目: It's time to prepare the problems for the 14th Zhejiang Provincial Collegiate Programming Contest! Almost all members of Zhejiang University programming contest problem setter t…
https://vjudge.net/contest/285902#overview A.Marjar Cola #include <bits/stdc++.h> using namespace std; int T; int main() { scanf("%d", &T); while(T --) { int x, y, a, b; ; scanf("%d%d%d%d", &x, &y, &a, &b); ||…
Marjar Cola Time Limit: 1 Second      Memory Limit: 65536 KB Marjar Cola is on sale now! In order to attract more customers, Edward, the boss of Marjar Company, decides to launch a promotion: If a customer returns x empty cola bottles or y cola bottl…
3860 - Find the Spy Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3860 Description Whoooa! There is a spy in Marjar University. All we know is that the spy has a special ID card. Please find him…
Description 题目描述 Bob is a freshman in Marjar University. He is clever and diligent. However, he is not good at math, especially in Mathematical Analysis. After a mid-term exam, Bob was anxious about his grade. He went to the professor asking about th…
ZOJ Problem Set - 3946 Highway Project Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, the emperor of the Marjar Empire, wants to build some bidirectional highways so that he can reach other cities from the capital as fast as possible. Thus…
ZOJ 2819 Average Score Time Limit: 2 Sec  Memory Limit: 60 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5373 Description Bob is a freshman in Marjar University. He is clever and diligent. However, he is not good at math, especia…
Seven Segment Display Time Limit: Seconds Memory Limit: KB A seven segment display, or seven segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays. Sev…