题目:

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的更多相关文章

  1. 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 ...

  2. 山东省第七届ACM省赛------Memory Leak

    Memory Leak Time Limit: 2000MS Memory limit: 131072K 题目描述 Memory Leak is a well-known kind of bug in ...

  3. 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 ...

  4. Candy Store

    Candy Store Time Limit: 30000ms, Special Time Limit:75000ms, Memory Limit:65536KB Total submit users ...

  5. Home · chineking/cola Wiki

    Home · chineking/cola Wiki Home Cola Cola是一个分布式的爬虫框架,用户只需编写几个特定的函数,而无需关注分布式运行的细节.任务会自动分配到多台机器上,整个过程对 ...

  6. sdut Mountain Subsequences 2013年山东省第四届ACM大学生程序设计竞赛

    Mountain Subsequences 题目描述 Coco is a beautiful ACMer girl living in a very beautiful mountain. There ...

  7. 牛客网暑期ACM多校训练营(第二场) D money 思维

    链接:https://www.nowcoder.com/acm/contest/140/D来源:牛客网 White Cloud has built n stores numbered from 1 t ...

  8. iOS之App Store上架被拒Legal - 5.1.5问题

    今天在看到App Store 上架过程中,苹果公司反馈的拒绝原因发现了这么一个问题: Legal - 5.1.5 Your app uses background location services ...

  9. 发布APP到app store

    好久好久没写博客了,主要是 都在学习新东西,忙不赢啊. 近段时间在用AC平台学习开发移动APP, 今天开始发布应用. 在ac云控制台编译成ipa后,使用apple提供的Application Load ...

  10. SCNU ACM 2016新生赛决赛 解题报告

    新生初赛题目.解题思路.参考代码一览 A. 拒绝虐狗 Problem Description CZJ 去排队打饭的时候看到前面有几对情侣秀恩爱,作为单身狗的 CZJ 表示很难受. 现在给出一个字符串代 ...

随机推荐

  1. springmvc 前端表单提交给后端出现乱码

    在springmvc框架练习中遇到了乱码问题,经过一番网上查找解决方法之后,最后发现是需要在tomcat中的server.xml中添加编码设置 URIEncoding="UTF-8" ...

  2. JS - 属性描述符各配置的默认值的注意事项

    通过字面量或者obj.x = 1;创建的属性 与 通过Object.defineProperty创建的属性,他们的属性描述符的默认值是不同的,前者都为true,后者都为false.

  3. Centos7上docker的安装和基本使用

    Centos7上Docker的相关操作 Docker的安装 1.检查内核版本 docker使用linux的内核必须是3.10以上,首先需要 # uname -r 2.使用yum安装docker # y ...

  4. Nginx 配置继承模型

    要了解nginx的继承模型,首先需要知道nginx使用多个配置块进行操作.在nginx中,这样的块被称为上下文,例如,放置在服务器上下文中的配置指令驻留在server { }块中,就像放置在http上 ...

  5. yii2 url 美化参数

    所谓的url参数美化就是将冗长的字符串 进行正则替换 yii2 框架的url参数美化完成需要完成两个阶段 第一个阶段分apache和nginx 两种的配置 apache :1.1 必须开启rewrit ...

  6. python 学习心得

    多用类或是函数 我以前写的时候,不用函数,从头写到尾,后来,要改成函数,也是要花很多测试的时间,改的话还得一个调试,如果一开始就用函数的话,就能节省很多时间. 函数的功能尽可能的小 比如说像我用try ...

  7. python+scrapy环境搭建步骤描述

    Python3(3.5.4)搭建爬虫系统步骤描述: 1.下载python安装包,路径:https://www.python.org/downloads/windows/  选择3.5.4版本64位的安 ...

  8. perl语言入门总结-第5章-输入输出

    读取标准输入 chomp($line = <STDIN>); #去掉后面的换行 while (defined($line = <STDIN>)) { print "I ...

  9. Python文章推荐1

    Table of Contents 1. 分享最近看到的python相关的几篇好文(我只是想偷懒) 1.1. 形象解释了什么是GIL 1.2. 知乎上 Pythonic 相关 1.3. evil &q ...

  10. nodejs安装&bower 安装

    1.进入官网下载:https://nodejs.org/en/ 2.直接进行安装,可以将安装路径设置为:D:\nodejs 3.进入node.js command prompt 命令窗口 4.检测是否 ...