codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

82A.md (1643B)


      1 Source: https://codeforces.com/problemset/problem/82/A
      2 
      3 A. Double Cola
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 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.
     22 
     23 For example, Penny drinks the third can of cola and the queue will look like this: Rajesh, Howard, Sheldon, Sheldon, Leonard, Leonard, Penny, Penny.
     24 
     25 Write a program that will print the name of a man who will drink the *n*-th can.
     26 
     27 Note that in the very beginning the queue looks like that: Sheldon, Leonard, Penny, Rajesh, Howard. The first person is Sheldon.
     28 
     29 Input
     30 
     31 The input data consist of a single integer *n* (1 ≤ *n* ≤ 109).
     32 
     33 It is guaranteed that the pretests check the spelling of all the five names, that is, that they contain all the five possible answers.
     34 
     35 Output
     36 
     37 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.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 1
     45 ```
     46 
     47 Output
     48 
     49 ```
     50 Sheldon
     51 ```
     52 
     53 Input
     54 
     55 ```
     56 6
     57 ```
     58 
     59 Output
     60 
     61 ```
     62 Sheldon
     63 ```
     64 
     65 Input
     66 
     67 ```
     68 1802
     69 ```
     70 
     71 Output
     72 
     73 ```
     74 Penny
     75 ```