CF82A.Double Cola
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Sheldon, Leonard, Penny, Rajesh and Howard are in the queue for a "Double Cola" drink vending machine; there are no other people in the queue. The first one in the queue (Sheldon) buys a can, drinks it and doubles! The resulting two Sheldons go to the end of the queue. Then the next in the queue (Leonard) buys a can, drinks it and gets to the end of the queue as two Leonards, and so on. This process continues ad infinitum.
For example, Penny drinks the third can of cola and the queue will look like this: Rajesh, Howard, Sheldon, Sheldon, Leonard, Leonard, Penny, Penny.
Write a program that will print the name of a man who will drink the n-th can.
Note that in the very beginning the queue looks like that: Sheldon, Leonard, Penny, Rajesh, Howard. The first person is Sheldon.
谢尔顿、伦纳德、佩妮、拉杰什和霍华德正在一台“双倍可乐”自动售货机前排队;队列中没有其他人。排在队首的人(谢尔顿)购买一罐饮料,喝完后分裂成两人!这两个谢尔顿排到队尾。接着,队列中的下一个人(伦纳德)购买一罐饮料,喝完后也分裂成两人,并排到队尾,依此类推。该过程无限持续下去。
例如,佩妮喝下了第三罐可乐,此时队列将变为:拉杰什、霍华德、谢尔顿、谢尔顿、伦纳德、伦纳德、佩妮、佩妮。
请编写一个程序,输出将喝下第 n 罐可乐的人的名字。
注意:初始队列顺序为:谢尔顿、伦纳德、佩妮、拉杰什、霍华德。队首为谢尔顿。
输入格式
The input data consist of a single integer n (1 ≤ n ≤ 109).
It is guaranteed that the pretests check the spelling of all the five names, that is, that they contain all the five possible answers.
输入数据包含一个整数 n(1 ≤ n ≤ 109)。
保证预测试用例涵盖了全部五个名字的拼写,即其中包含了全部五种可能的答案。
输出格式
Print the single line — the name of the person who drinks the n-th can of cola. The cans are numbered starting from 1. Please note that you should spell the names like this: "Sheldon", "Leonard", "Penny", "Rajesh", "Howard" (without the quotes). In that order precisely the friends are in the queue initially.
输出一行——喝第 n 罐可乐的人的名字。可乐罐编号从 1 开始。请注意,名字的拼写必须严格如下:“Sheldon”、“Leonard”、“Penny”、“Rajesh”、“Howard”(不带引号)。朋友最初在队列中的顺序即为此顺序。
输入输出样例
输入#1
1
输出#1
Sheldon
输入#2
6
输出#2
Sheldon
输入#3
1802
输出#3
Penny
输入解题思路,AI测评打分。不知道怎么写?