Page 1 of 1

11689 - Soda Surpler

Posted: Wed Oct 21, 2009 5:09 pm
by Mohsin Reza Razib
I am continuously getting WA for the following code. I am completely depressed. Somebody please help. :cry:
accepted. Removed.

Re: 11689 Soda Surpler wrong answer

Posted: Thu Oct 22, 2009 7:13 am
by poixp
res=start=(e+f)/c;
a=(e+f)%c;
while(start)
{
res+=(start+a)/c;
a=(start+a)%c;
start=start/c; **** This is wrong
}

Try use this
while(start)
{
int NumToBuy = (start+a)/c;
res+= NumToBuy;
a=(start+a)%c;
start = NumToBuy;
}

Re: 11689 Soda Surpler wrong answer

Posted: Thu Oct 22, 2009 7:43 am
by Mohsin Reza Razib
Thanks buddy. I finally got accepted. :D I never consider there was a problem in my logic. I thought it was a output related error. My eyes are open now and i will be focus in future.
Thanks mr. poixp again.

Re: 11689 Soda Surpler wrong answer

Posted: Thu Oct 22, 2009 8:50 am
by poixp
Everyone make mistakes. Good luck for further problem solving.

Re: 11689 Soda Surpler wrong answer

Posted: Wed Oct 20, 2010 1:13 am
by amine.hamdaoui
Hello,
I'm getting WA, I tried many case but I can't find the problem?

Code: Select all

#include <iostream>

using namespace std;

int main()
{
    int nbcas,e,f,c,botle, sum, modulo;

    cin>>nbcas;

    for(int i=0 ; i<nbcas;i++)
    {
        cin>>e>>f>>c;

        botle   = e+f;
        sum     = 0;
        modulo  = botle%c;
        botle   = botle/c;
        sum    += botle;

        while(true)
        {
            botle   = (botle+modulo)/c;
            modulo  = (botle+modulo)%c;
            sum     += botle;

            if((botle+modulo) < c)
            {
                cout<<sum<<endl;
                break;
            }
        }
    }

    return 0;
}

Re: 11689 Soda Surpler wrong answer

Posted: Thu Oct 28, 2010 7:02 pm
by amine.hamdaoui
Can you please help, any idea, special case?

11689 Soda Surpler Getting TLE, Why? please, help me

Posted: Fri Dec 16, 2011 3:29 pm
by opo

Code: Select all

removed after ac

Re: 11689 Soda Surpler wrong answer

Posted: Sat Aug 03, 2013 6:09 am
by AKJ88
Input:

Code: Select all

25
999 998 44
999 998 7
999 998 14
999 998 9
999 998 6
999 998 3
999 998 113
999 998 13
999 998 17
999 998 123
9 0 3
5 5 2
999 998 222
50 50 6
855 22 32
665 21 4
800 200 14
147 651 21
333 265 8
222 144 28
255 666 34
889 554 1001
362 879 214
999 999 1225 
214 689 140
AC Output:

Code: Select all

46
332
153
249
399
998
17
166
124
16
4
9
9
19
28
228
76
39
85
13
27
1
5
1
6

Re: 11689 Soda Surpler wrong answer

Posted: Fri Dec 27, 2013 8:19 pm
by Angry Bird
Why WA. All ans ok But why?

Code: Select all

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,k,r,s,m,cas,i,n2,n1;
    scanf("%d",&cas);
    while(cas--)
    {
        scanf("%d%d%d",&n2,&n1,&k);
        n=n1+n2;
        s=(n-1)/(k-1);
        printf("%d\n",s);
    }
    return 0;
}


Re: 11689 Soda Surpler wrong answer

Posted: Wed Jan 15, 2014 12:01 am
by brianfry713
Input:

Code: Select all

1
0 0 2
AC output 0

getting T.L.E

Posted: Fri Aug 22, 2014 12:28 am
by touristvisitor
why i am getting T.L.E in http://uva.onlinejudge.org/external/116/11689.html

here is my code

#include <iostream>

using namespace std;



int main(){

long long a,b,c,n,kase,p,q;
cin >> kase;
while(kase--){
long long res = 0;
cin >> a >> b >> c;
n = a + b;
while(n != 1){
p = n % c;
q = n / c;
res = res + q;
n = p + q;
}
cout << res << endl;

}

return 0;
}

Re: 11689 - Soda Surpler

Posted: Tue Aug 26, 2014 6:58 pm
by lighted

Code: Select all

Use code tags. When posting add problem number in post subject
Change line

Code: Select all

while(n != 1){
It must be

Code: Select all

while(n >= c){
Don't forget to remove your code after getting accepted. 8)