Problem description

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.

Input

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.

Output

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.

Examples

Input

1

Output

Sheldon

Input

6

Output

Sheldon

Input

1802

Output

Penny
解题思路:简单找规律。

结论更正一下:于是当t%s!=0时,index=t/s+1。
AC代码:

 #include<bits/stdc++.h>
using namespace std;
const string obj[]={"Sheldon","Leonard","Penny","Rajesh","Howard"};
int main(){
int m,n,t,s,index;cin>>n;
m=log(n/5.0+1.0)/log(2.0);//换底公式
t=(n-*((s=pow(,m))-));
if(n>){
if(t%s)index=t/s+;
else index=t/s;
}
else index=n;
cout<<obj[index-]<<endl;
return ;
}

B - Double Cola的更多相关文章

  1. 快速切题CF 158B taxi 构造 && 82A double cola 数学观察 难度:0

    实在太冷了今天 taxi :错误原因1 忽略了 1 1 1 1 和 1 2 1 这种情况,直接认为最多两组一车了 2 语句顺序错 double cola: 忘了减去n的序号1,即n-- B. Taxi ...

  2. codeforces水题100道 第六题 Yandex.Algorithm 2011 Qualification 2 A. Double Cola (math)

    题目链接:www.codeforces.com/problemset/problem/82/A题意:五个人排队喝可乐,一个人喝完一杯,就在可乐的最后面放两杯自己喝的可乐,问第n个喝的人是谁.C++代码 ...

  3. Yandex.Algorithm 2011 A. Double Cola

    1.题目描写叙述:点击打开链接 2.解题思路:本题是一道找规律的数学题,通过题意描写叙述不难知道,相当于有5棵二叉树构成了一个森林,须要你按层次遍历找到第n个人是谁. 观察后不难发现,如果最開始的一层 ...

  4. codeforcess水题100道

    之所以在codeforces上找这100道水题的原因是为了巩固我对最近学的编程语言的掌握程度. 找的方式在codeforces上的PROBLEMSET中过的题最多的那些题里面出现的最前面的10个题型, ...

  5. Bzoj 1857: [Scoi2010]传送带(三分套三分)

    1857: [Scoi2010]传送带 Time Limit: 1 Sec Memory Limit: 64 MB Description 在一个2维平面上有两条传送带,每一条传送带可以看成是一条线段 ...

  6. Java:Double Brace Initialization

    在我刚刚接触现在这个产品的时候,我就在我们的代码中接触到了对Double Brace Initialization的使用.那段代码用来初始化一个集合: final Set<String> ...

  7. Double Dispatch讲解与实例-面试题

    引言 说实话,我看过GoF<Design Patterns>,也曾深深的被李建忠<设计模式>系列Webcast吸引.但是还没有见过“Double Dispatch模式”.的确G ...

  8. Sql的decimal、float、double类型的区别

    三者的区别介绍 float:浮点型,含字节数为4,32bit,数值范围为-3.4E38~3.4E38(7个有效位) double:双精度实型,含字节数为8,64bit数值范围-1.7E308~1.7E ...

  9. decimal与double,float的选择与区别

    decimal 类型可以精确地表示非常大或非常精确的小数.大至 1028(正或负)以及有效位数多达 28 位的数字可以作为 decimal类型存储而不失其精确性.该类型对于必须避免舍入错误的应用程序( ...

随机推荐

  1. redis --------- 使用命令(每天一个)

    Key(键) Del     语法:DEL  Key [key ...]     删除给定的一个或者多个key  不存在的key会被忽略. 返回值: 被删粗key的数量# 删除单个 key redis ...

  2. Django REST framework 分页

    三种分页:根据页码.根据索引.根据加密 http://www.xx.com/courses/?page=1&size=10 http://www.xx.com/courses/?offset= ...

  3. RabbitMQ在Ubuntu上的环境搭建

    1.修改/etc/apt/sources.list文件 A:命令:vi /etc/apt/sources.list B:在最后一行加上:deb http://www.rabbitmq.com/debi ...

  4. 9.2 Socket编程

    远程管理软件和黑客软件大多依赖于Socket来实现特定功能,前几年流行的端口反弹更是把这项技术发挥到了极致. 如前所述,UDP和TCP是网络体系结构的传输层运行的两大重要协议,其中,TCP适用于对效率 ...

  5. [数据结构]C#顺序表的实现

    在数据结构的学习当中,想必C++可能是大家接触最多的入门语言了 但是C#的数据结构却很少看到,今天我写了一个C#顺序表的顺序存储结构 顺序表是在计算机内存中以数组的形式保存的线性表,线性表的顺序存储是 ...

  6. Win8.1 Hyper-V 共享本机IP上网

    公司的Win8.1自带了Hyper v,可是死活连接不到网络. 原因是公司只给每人分配一个局域网IP,而默认情况下Hyper-V的虚拟机会动态分配了一个没有经过MIS人员许可的IP…… 百度了N久解决 ...

  7. noip模拟赛 站军姿

    分析:纯数学题.相离和包含关系的可以很容易算出来答案,相交的话要先求出两个圆的面积,然后减掉中间重叠的部分,这一部分并不能直接求出来,但是可以求出两个扇形的面积,和它们围成的一个四边形的面积,加加减减 ...

  8. 某种密码(password.*)

    关于某种密码有如下描述:某种密码的原文A是由N个数字组成,而密文B是一个长度为N的01数串,原文和密文的关联在于一个钥匙码KEY.若KEY=∑▒[Ai*Bi],则密文就是原文的一组合法密码.现在有原文 ...

  9. hpu第六次周赛Problem F

    Problem F Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Sub ...

  10. [bzoj3529][Sdoi2014]数表_树状数组_莫比乌斯反演

    数表 bzoj-3529 Sdoi-2014 题目大意:n*m的数表,第i行第j列的数是同时整除i和j的所有自然数之和.给定a,求数表中所有不超过a的和. 注释:$1\le n,m \le 10^5$ ...