ACM-The Coco-Cola Store
题目:
Once upon a time, there is a special coco-cola store. If you return three empty bottles to the shop, you'll get a full bottle of coco-cola to drink. If you have n empty bottles right in your hand, how many full bottles of coco-cola can you drink?
输入
There will be at most 10 test cases, each containing a single line with an integer n (1<=n<=100). The input terminates with n = 0, which should not be processed
输出
For each test case, print the number of full bottles of coco-cola that you can drink.
样例输入
3
10
81
0
样例输出
1
5
40
题意:3个空瓶子换一瓶可乐,注意2个空瓶子的时候,借一个空瓶子的情况。
AC code
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
int n;
while(scanf("%d", &n),n){
int sum = ;
while(n>=){
if(n ==){
n++;
}else{
sum += n/;
n = n/+n%;
}
}
cout<<sum<<endl;
}
return ;
}
ACM-The Coco-Cola Store的更多相关文章
- ACM第三次比赛UVA11877 The Coco-Cola Store
Once upon a time, there is a special coco-cola store. If you return three empty bottles to the sho ...
- 山东省第七届ACM省赛------Memory Leak
Memory Leak Time Limit: 2000MS Memory limit: 131072K 题目描述 Memory Leak is a well-known kind of bug in ...
- ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 G. Garden Gathering
Problem G. Garden Gathering Input file: standard input Output file: standard output Time limit: 3 se ...
- Candy Store
Candy Store Time Limit: 30000ms, Special Time Limit:75000ms, Memory Limit:65536KB Total submit users ...
- Home · chineking/cola Wiki
Home · chineking/cola Wiki Home Cola Cola是一个分布式的爬虫框架,用户只需编写几个特定的函数,而无需关注分布式运行的细节.任务会自动分配到多台机器上,整个过程对 ...
- sdut Mountain Subsequences 2013年山东省第四届ACM大学生程序设计竞赛
Mountain Subsequences 题目描述 Coco is a beautiful ACMer girl living in a very beautiful mountain. There ...
- 牛客网暑期ACM多校训练营(第二场) D money 思维
链接:https://www.nowcoder.com/acm/contest/140/D来源:牛客网 White Cloud has built n stores numbered from 1 t ...
- iOS之App Store上架被拒Legal - 5.1.5问题
今天在看到App Store 上架过程中,苹果公司反馈的拒绝原因发现了这么一个问题: Legal - 5.1.5 Your app uses background location services ...
- 发布APP到app store
好久好久没写博客了,主要是 都在学习新东西,忙不赢啊. 近段时间在用AC平台学习开发移动APP, 今天开始发布应用. 在ac云控制台编译成ipa后,使用apple提供的Application Load ...
- SCNU ACM 2016新生赛决赛 解题报告
新生初赛题目.解题思路.参考代码一览 A. 拒绝虐狗 Problem Description CZJ 去排队打饭的时候看到前面有几对情侣秀恩爱,作为单身狗的 CZJ 表示很难受. 现在给出一个字符串代 ...
随机推荐
- WIN10使用安装包安装Mysql5.6+JDBC
很多教程教的是安装绿色版mysql或者是安装zip版的mysql,没什么不好,各有千秋,今天要教大家的是使用mysql-installer-community-5.6.43.0.msi安装mysql5 ...
- 数据写入Excel
通过xlwt这个库,可以将数据写入Excel中,而且通过xlwt写excel格式可以控制 颜色.模式.编码.背景色 下面基本上是一个练习,熟悉如何操作xlwt库的 下面是代码,所有的内容,和介绍,基本 ...
- 在Ubuntu下安装gcc编译器+测试
1.输入命令: sudo apt-get install gcc libc6-dev 2.创建文件hello.c使用命令: touch hello.c 3.在hello.c中写入: #include ...
- android gesture检测
1.关于on<TouchEvent>的返回值 a return value of true from the individual on<TouchEvent> methods ...
- 平时收集的一些有关UED的团队和个人博客
平时收集的一些有关UED的团队和个人博客 前端团队阿里巴巴 UED -- 我们设计的界面,并没有几十亿的流量,但每天来自上百个国家的百万商人在使用着.阿里巴巴中国站UED -- 阿里巴巴中国站UED成 ...
- 《Cracking the Coding Interview》——第5章:位操作——题目1
2014-03-19 05:45 题目:给定两个数M和N,将N按照二进制位,覆盖到M的特定段位中去. 解法:位操作,请看代码. 代码: // 5.1 Insert one number into th ...
- JFinal Template Engine 使用
官方文档:JFinal Template Engine 文档
- appium-手势密码实现-automationName 是Appium的情况
1. 红色区域的范围为:[66,575][1014,1523], 由于这块是一个整块,所以无法使用每个点的数据:因此只能使用LockPatternView对象拿到左上角的坐标值 2. 原理, 将九宫 ...
- eclipse里导入maven项目有红叉的解决办法
导入maven的项目上有红叉,说明eclipse里maven的插件该更新了 1.help里选择install new software 2.点击add,输入name:MavenArchiver, lo ...
- Python学习5,三级菜单实例
_author_ = "Happyboy" data = { '北京':{ "昌平":{ "沙河":["Happyboy" ...