mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-06-09 22:11:55 +00:00
[Init] Solved solutions
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
const unsigned int size = 5;
|
||||
char* c[size] = {"Sheldon", "Leonard", "Penny", "Rajesh", "Howard"};
|
||||
int n, m = 0, r = 1;
|
||||
cin >> n;
|
||||
while (n > m)
|
||||
{
|
||||
m += size*r;
|
||||
r *= 2;
|
||||
}
|
||||
r /= 2;
|
||||
n = n - m + size*r;
|
||||
int pos = n/r;
|
||||
if (n%r == 0)
|
||||
{
|
||||
pos--;
|
||||
}
|
||||
cout << c[pos];
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user