Skip to content
This repository was archived by the owner on Jun 20, 2026. It is now read-only.
Open

DANGER #1284

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ In this repository, you can find the solutions (as source code) for the problems
| [Nauman Chaudhary](https://github.com/nauman-chaudhary) <br> <img src="https://github.com/nauman-chaudhary.png" width="100" height="100"> | Pakistan | Python | |
| [Gourav Rusiya](https://github.com/GouravRusiya30) <br> <img src="https://github.com/GouravRusiya30.png" width="100" height="100"> | India | Java | https://www.hackerrank.com/gouravrusiya786 |
| [Trushita Maurya](https://github.com/trushita23) <br> <img src="https://github.com/trushita23.png" width="100" height="100"> | India | Java
| [Saida Jahan](https://github.com/sasasaida) <br> <img src="https://github.com/sasasaida.png" width="100" height="100"> | Bangladesh | C++, Python
### License

[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://github.com/ows-ali/Hacktoberfest/blob/master/LICENSE)
20 changes: 20 additions & 0 deletions SPOJ/DANGER.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <bits/stdc++.h>
using namespace std;

int main()
{
while (true)
{
string s;
cin >> s;
if (s == "00e0")
break;

int n = stod(s);
int a = floor(log2(n));
int l = n - pow(2, a);
int result = 2 * l + 1;

cout << result << endl;
}
}