Codeforces 476A - Dreamoon and Stairs Solution
Solution in C++:
///La ilaha illellahu muhammadur rasulullah
///******Bismillahir-Rahmanir-Rahim******///
///AH Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- long n,m,c;
- cin>>n>>m;
- if(n<m)
- cout<<"-1"<<endl;
- else
- {
- c=(n+1)/2;
- while(c%m!=0)
- c++;
- }
- cout<<c<<endl;
- }
No comments