10170 - The Hotel with Infinite Rooms

#include <stdio.h>

int main()
    {
    long S,D,sum;
    while(scanf("%ld%ld",&S,&D)==2)
        {
        sum=0;
        while(D > sum)
             {
             sum += S;
             S += 1;
             } // End of inner while
        printf("%ld\n",S-1);
        } // End of while
    } // End of main

Comments

Popular posts from this blog

371 - Ackermann Functions

Create many folder with one click