Page 1 of 2
12502 - Three Families
Posted: Tue Sep 03, 2013 7:09 pm
by xplosive
Why i am getting runtime error...? I tried for four time but same result rte...
Code: Select all
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
//freopen("uvainput.txt", "r", stdin);
//freopen("uvaoutput.txt", "w", stdout);
int t,tt;
scanf("%d",&tt);
int x,y,z,ave,over,r;
for(t=0; t<tt; t++)
{
scanf("%d%d%d",&x,&y,&z);
ave=(x+y)/3;
over = x-ave;
r= z*over/ave;
printf("%d\n",r);
}
return 0;
}
Re: 12502 - Three Families
Posted: Tue Sep 03, 2013 10:01 pm
by brianfry713
Re: 12502 - Three Families
Posted: Thu Oct 31, 2013 6:24 am
by mahade hasan
brianfry713 wrote:Try input:
out put will be floating
what will be the answer
Re: 12502 - Three Families
Posted: Thu Oct 31, 2013 10:46 pm
by brianfry713
0
Re: 12502 - Three Families
Posted: Sat Dec 07, 2013 10:53 am
by Minarmahmud
brianfry713 wrote:0
Sir, I think the AC output is 1.
Re: 12502 - Three Families
Posted: Wed Dec 11, 2013 12:14 am
by brianfry713
Either 1 or 0 would make sense. There won't be a case like that in the judge's input.
12502 - Three Families
Posted: Fri Feb 21, 2014 7:28 pm
by me33
got WA.
can't find error.
plz help.
removed after AC

Re: 12502 - Three Families get WA ! plz help
Posted: Fri Mar 21, 2014 8:53 pm
by cse dipto
Code: Select all
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <cctype>
#include <stack>
#include <queue>
#include <map>
#include <vector>
using namespace std;
int main()
{
double i,j,k,t_case,f1,f2,money,dif,tmp;
int f1_money ;
cin >> t_case ;
for(i = 1 ; i <= t_case ; i++)
{
dif = 0 ;
cin >> f1 >> f2 >> money ;
if(f1 > f2)
dif = f1 - f2 ;
tmp = (money / (f1 + f2));
f1_money = (tmp * (f1 + dif)) ;
cout << f1_money << endl ;
}
return 0;
}
Re: 12502 - Three Families
Posted: Sat Mar 22, 2014 1:27 am
by sadee
Does't Match simple I/O
Code: Select all
Input:
3
6 7 50
3 9 120
11 11 987
your code says:
23
30
246
Re: 12502 - Three Families
Posted: Sat Mar 22, 2014 1:31 am
by sadee
time_limit(CUET_Triangle)'s acc code says:
Re: 12502 - Three Families
Posted: Sat Jul 05, 2014 2:31 pm
by uDebug
Beware this is one of those annoyingly clever problems on UVa. The problem statement is confusing (on purpose) - and then if you use floating point numbers you'll likely end up getting a WA.
In regards to the problem statement: What's not made very clear is that the families do not get paid for their own share of the work. Family C is paying Family A and B only for work that Family C did not do.
On the floating point front, think a little outside the box. Maybe a change in time units, perhaps.
Re: 12502 - Three Families
Posted: Sat Sep 06, 2014 4:52 pm
by lighted
v1n1t wrote:Beware this is one of those annoyingly clever problems on UVa. The problem statement is confusing (on purpose) - and then if you use floating point numbers you'll likely end up getting a WA.
In regards to the problem statement: What's not made very clear is that the families do not get paid for their own share of the work. Family C is paying Family A and B only for work that Family C did not do.
On the floating point front, think a little outside the box. Maybe a change in time units, perhaps.
I got accepted using only double for variables.

Re: 12502 - Three Families
Posted: Sat Sep 13, 2014 4:03 pm
by Shahidul.CSE
I am getting WA with my code. Whats wrong?
Re: 12502 - Three Families
Posted: Sat Sep 13, 2014 6:39 pm
by brianfry713
Try solving it without using floating-point numbers.
Re: 12502 - Three Families
Posted: Sat Sep 13, 2014 7:53 pm
by Shahidul.CSE
I can't figure out the trick to solve using int .
