codeforces水题100道 第六题 Yandex.Algorithm 2011 Qualification 2 A. Double Cola (math)
2016-07-20 16:17
573 查看
题目链接:www.codeforces.com/problemset/problem/82/A
题意:五个人排队喝可乐,一个人喝完一杯,就在可乐的最后面放两杯自己喝的可乐,问第n个喝的人是谁。
C++代码:
C++
题意:五个人排队喝可乐,一个人喝完一杯,就在可乐的最后面放两杯自己喝的可乐,问第n个喝的人是谁。
C++代码:
#include <cstdio> #include <iostream> using namespace std; int main() { int n; cin >> n; n --; while (n >= 5) { n -= 5; n /= 2; } switch (n) { case 0: puts("Sheldon"); break; case 1: puts("Leonard"); break; case 2: puts("Penny"); break; case 3: puts("Rajesh"); break; default: puts("Howard"); break; } return 0; }
C++
相关文章推荐
- Exactly one month ago
- Web开发之Django框架的学习
- Golang在视频直播平台的高性能实践(含PPT下载)
- golang x/net/context包笔记
- Go 辅助工具
- 【Google Protobuf】protobuf的使用(二)
- Golang string处理
- Django缓存机制
- log4j root 和 category (logger)关系
- 替换hosts使用google搜索
- Yandex.Algorithm 2011 Round 1 D. Sum of Medians 线段树
- MangoDB 实例
- 【Deep Learning学习笔记】Efficient Estimation of Word Representations in Vector Space_google2013
- 大话设计模式(golang) 七、模版方法模式
- GO语言按照深度遍历文件
- Network Connection Lost When Windows 8 Goes To Sleep
- 01 类目Category、延展Extension、协议Protocol、计数器的使用NSTimer
- codeforces 616D Longest k-Good Segment 尺取法
- 访问不了Google
- 搭建Go开发及调试环境(LiteIDE + GoClipse) -- Windows篇