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
int main()
{
long S,D,sum;
while(scanf("%ld%ld",&S,&D)==
{
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
Post a Comment