11689 - Soda Surpler

All about problems in Volume 116. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
Mohsin Reza Razib
New poster
Posts: 12
Joined: Fri Dec 15, 2006 12:57 pm
Location: Dhaka, Bangladesh
Contact:

11689 - Soda Surpler

Post by Mohsin Reza Razib » Wed Oct 21, 2009 5:09 pm

I am continuously getting WA for the following code. I am completely depressed. Somebody please help. :cry:
accepted. Removed.
Last edited by Mohsin Reza Razib on Thu Oct 22, 2009 7:44 am, edited 1 time in total.
Mohsin Reza
"The tragedy of life does not lie in not reaching your goal. The tragedy lies in having no goal to reach".- Benajamin Mays

poixp
New poster
Posts: 20
Joined: Mon Apr 07, 2008 11:05 am

Re: 11689 Soda Surpler wrong answer

Post by poixp » Thu Oct 22, 2009 7:13 am

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;
}

Mohsin Reza Razib
New poster
Posts: 12
Joined: Fri Dec 15, 2006 12:57 pm
Location: Dhaka, Bangladesh
Contact:

Re: 11689 Soda Surpler wrong answer

Post by Mohsin Reza Razib » Thu Oct 22, 2009 7:43 am

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.
Mohsin Reza
"The tragedy of life does not lie in not reaching your goal. The tragedy lies in having no goal to reach".- Benajamin Mays

poixp
New poster
Posts: 20
Joined: Mon Apr 07, 2008 11:05 am

Re: 11689 Soda Surpler wrong answer

Post by poixp » Thu Oct 22, 2009 8:50 am

Everyone make mistakes. Good luck for further problem solving.

amine.hamdaoui
New poster
Posts: 10
Joined: Tue Aug 07, 2007 7:33 pm

Re: 11689 Soda Surpler wrong answer

Post by amine.hamdaoui » Wed Oct 20, 2010 1:13 am

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;
}

amine.hamdaoui
New poster
Posts: 10
Joined: Tue Aug 07, 2007 7:33 pm

Re: 11689 Soda Surpler wrong answer

Post by amine.hamdaoui » Thu Oct 28, 2010 7:02 pm

Can you please help, any idea, special case?

opo
New poster
Posts: 2
Joined: Tue Dec 13, 2011 8:51 am

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

Post by opo » Fri Dec 16, 2011 3:29 pm

Code: Select all

removed after ac
Last edited by opo on Wed Jan 04, 2012 9:52 am, edited 1 time in total.

AKJ88
New poster
Posts: 20
Joined: Wed Feb 13, 2013 10:48 am

Re: 11689 Soda Surpler wrong answer

Post by AKJ88 » Sat Aug 03, 2013 6:09 am

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

Angry Bird
New poster
Posts: 21
Joined: Mon Apr 08, 2013 8:38 am

Re: 11689 Soda Surpler wrong answer

Post by Angry Bird » Fri Dec 27, 2013 8:19 pm

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;
}


brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11689 Soda Surpler wrong answer

Post by brianfry713 » Wed Jan 15, 2014 12:01 am

Input:

Code: Select all

1
0 0 2
AC output 0
Check input and AC output for thousands of problems on uDebug!

touristvisitor
New poster
Posts: 1
Joined: Fri Aug 22, 2014 12:15 am

getting T.L.E

Post by touristvisitor » Fri Aug 22, 2014 12:28 am

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;
}

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11689 - Soda Surpler

Post by lighted » Tue Aug 26, 2014 6:58 pm

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)
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

Post Reply

Return to “Volume 116 (11600-11699)”