11689 - Soda Surpler
Posted: Wed Oct 21, 2009 5:09 pm
I am continuously getting WA for the following code. I am completely depressed. Somebody please help.
accepted. Removed.

accepted. Removed.
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;
}
Code: Select all
removed after ac
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
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
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;
}
Code: Select all
1
0 0 2
Code: Select all
Use code tags. When posting add problem number in post subject
Code: Select all
while(n != 1){
Code: Select all
while(n >= c){