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
Mohsin Reza Razib
New poster
Posts: 12 Joined: Fri Dec 15, 2006 12:57 pm
Location: Dhaka, Bangladesh
Contact:
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.
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
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:
Post
by Mohsin Reza Razib » Thu Oct 22, 2009 7:43 am
Thanks buddy. I finally got accepted.
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
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
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;
}
opo
New poster
Posts: 2 Joined: Tue Dec 13, 2011 8:51 am
Post
by opo » Fri Dec 16, 2011 3:29 pm
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
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
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
Post
by brianfry713 » Wed Jan 15, 2014 12:01 am
Check input and AC output for thousands of problems on
uDebug !
touristvisitor
New poster
Posts: 1 Joined: Fri Aug 22, 2014 12:15 am
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: 587 Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek
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
It must be
Don't forget to remove your code after getting accepted.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman