diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-29 00:05:50 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-29 00:05:50 +0200 |
| commit | 9997eb6fae11ca927df90c9712ce335b5a3f0cd0 (patch) | |
| tree | d4d69eb4f068629d020ca02a04335986eea9a74b /InfinityStaircase.cpp | |
| parent | aafb97c04f8b29d3e9e2e56b18614e73b5956125 (diff) | |
| download | competitive-programming-9997eb6fae11ca927df90c9712ce335b5a3f0cd0.tar.xz competitive-programming-9997eb6fae11ca927df90c9712ce335b5a3f0cd0.zip | |
Added a new directory codechef which contains some problem I solved on codechef.com
Diffstat (limited to 'InfinityStaircase.cpp')
| -rw-r--r-- | InfinityStaircase.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/InfinityStaircase.cpp b/InfinityStaircase.cpp new file mode 100644 index 0000000..aeb982a --- /dev/null +++ b/InfinityStaircase.cpp @@ -0,0 +1,24 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main() { + int tt; + cin >> tt; + while(tt--) { + int n; + cin >> n; + n-=1; + if(n % 5 == 0) { + cout << (n / 5) * 2 << endl; + } + else{ + if(n % 5 == 1 || n % 5 == 2 || n % 5 == 3) { + cout << ((n / 5) * 2) + 1 << endl; + } + else if(n % 5 == 4) { + cout << ((n / 5) * 2) + 2 << endl; + } + } + } +} |
