Triple Pepsi



Triple Pepsi

Our big brothers ---- Giri, Perichi, Collin, Clinton, Karthi and Jeeva are in the queue for a "Triple Pepsi" drink vending machine; there are no other people in the queue. The first one in the queue (Giri) buys a can, drinks it and triples! The resulting three Giris go to the end of the queue. Then the next in the queue (Perichi) buys a can, drinks it and gets to the end of the queue as three Perichis, and so on. This process continues ad infinitum.
For example, if our brother Collin drinks the third can of pepsi , the queue will look like this: Clinton, Karthi, Jeeva, Giri, Giri, Giri, Perichi, Perichi, Perichi, Collin, Collin, Collin
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: Giri, Perichi, Collin, Clinton, Karthi, Jeeva . The first person is Giri.
Input Format
The input data consist of a single integer n (1 ≤ n ≤ 5000).
Output Format
Print the single line — the name of the person who drinks the n-th can of pepsi. The cans are numbered starting from 1. Please note that you should spell the names like this: “Giri”, “Perichi”, “Collin”, “Clinton”, “Karthi”, “Jeeva” (without the quotes). In that order precisely the brothers are in the queue initially.

Image result for triple pepsi

Sample Input 1
 1
Sample Output 1
 Giri
Sample Input 2
 7
Sample Output 2
 Giri
Sample Input 3
 1802
Sample Output 3
 Karthi
Sample Input 4
 -10
Sample Output 4
 Invalid Input
#include
int main()
{
int a[5000],k,l,m,n;
l=0;
scanf("%d",&n);
if(n>=1&&n<=5000)
{
for(k=1;k<=729&&l<5000 0="" a="" arthi="" eeva="" else="" erichi="" for="" if="" input="" iri="" k="k*3)" l="" linton="" m="" n--="" n="" nvalid="" ollin="" printf="" return="" span="">

No comments: