Skip to content

Commit 6ef8c1d

Browse files
authored
Create Strange Counter
1 parent 852a863 commit 6ef8c1d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Strange Counter

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//https://www.hackerrank.com/challenges/strange-code/problem
2+
#include <bits/stdc++.h>
3+
4+
using namespace std;
5+
6+
int main()
7+
{
8+
long int t;
9+
cin >> t;
10+
long int rem = 3;
11+
while( t > rem)
12+
{
13+
t = t-rem;
14+
rem *= 2;
15+
}
16+
cout<<rem-t+1;
17+
18+
return 0;
19+
}

0 commit comments

Comments
 (0)