UVA 10170 - The Hotel with Infinite Rooms

Problem PDF

Solution:

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ll long long
#define sc scanf
#define pf printf
#define pi 2*acos(0.0)
using namespace std;
ll day(ll s,ll d)
{
    ll sum=0,i;
    for(i=s;;i++)
    {
        sum=sum+i;
        if(sum>=d)
        {
            break;
        }
    }
    return i;
}
int main()
{
    ll s,d;
    while(sc("%lld %lld",&s,&d)==2)
    {
        pf("%d\n",day(s,d));
    }
    return 0;
}
https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/10170/10170.cpp