题解 | #汽水瓶#

汽水瓶

http://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f

2个瓶子可以借一个,然后兑换一个瓶子,喝完后再还回去,刚好是一种最小的稳定结构,直接整除2;

#include <string>
#include <map>
#include <vector>

using namespace std;




int main() {
    string str;
    int x=0;
    while(getline(cin,str)){
        x=stoi(str);
        if(x==0) break;
        else x=x/2;
        cout<<x<<endl;
        
    }
    
    
    
}
全部评论

相关推荐

给个offer灞:校友 是不是金die
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务