VENOM - Touch of Venom
#include<stdio.h>
int main()
{
long long int t,h,p,k,a,count,i;
scanf("%lld",&t);
while(t--)
{ i=1,count=0;
scanf("%lld%lld%lld",&h,&p,&a);
while(h!=0)
{
k=i*p;
i++;
h=h-k;
count++;
if(h>0)
{
h=h+a;
count++;
}
else
break;
}
printf("%lld\n",count);
}
}
Comments
Post a Comment