uva 11150-cola, getting Time limit error but why!!!

The forum to report every bug you find or tell us what you'd like to find in UVa OJ

Moderator: Board moderators

Post Reply
leocris
New poster
Posts: 1
Joined: Sun Jun 25, 2017 1:04 pm

uva 11150-cola, getting Time limit error but why!!!

Post by leocris »

#include <stdio.h>
int main()
{
int a,c,n,b,sum;
while(1){scanf("%d", &n);
c=n;
sum=0;
while(n>=3){
sum=n/3+sum;
n=n/3+n%3;
}

if(n==2) {printf("%d\n",sum+c+1);}
else printf("%d\n",sum+c);
}
return 0;

}
Post Reply

Return to “Bugs and suggestions”