Advertisement
Babul_420

10170 - The Hotel with Infinite Rooms

Apr 4th, 2018
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     long long int s,m,i,sum;
  6.     while(cin>>s>>m)
  7.     {
  8.         sum=0;
  9.         for(i=s; ; i++)
  10.         {
  11.             sum+=i;
  12.             if(sum==m || sum>m )
  13.                {
  14.                 cout<<i<<endl;
  15.                break;
  16.  
  17.                }
  18.         }
  19.     }
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement