Uva 11150 – Cola

Problem Link

Solution :-

#include<stdio.h>
int main()
{
int a,n;
while(scanf(“%d”,&n)==1)
{
a=n;
while(n>=3)
{
a=a+(n/3);
n=(n/3)+(n%3);
}
if(n==2)
{
a++;
}
printf(“%dn”,a);
}
return 0;
}

At First you can try to solve this problem if you can’t than see this code & find what’s your problem . If you copy paste this code you could not improve yourself in programming .

Posted by Shipu Ahamed

Leave a Reply