mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-10-11 12:09:23 +00:00
[Init] Solved solutions
This commit is contained in:
1 parent
51f667ac81
commit
20542601dd
131 files changed
+4148
No files matched your search
+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