Page 1 of 3
10773 - Back to Intermediate Math
Posted: Mon Nov 29, 2004 8:56 pm
by TISARKER
Please Tell me why the following code gives wrong answer ?
#include<stdio.h>
#include<math.h>
#define type int
#define dtype double
void main()
{
type i,n;
dtype u,v,d;
//freopen("F:\\input.txt","r",stdin);
//freopen("F:\\myput.txt","w",stdout);
scanf("%d",&n);n++;
for(i=1;i<n;i++)
{
scanf("%lf%d%d",&d,&v,&u);
if((u>v)&&(u!=0)&&(v!=0))
printf("Case %d: %.3lf\n",i,an expresion));
else printf("can't determine\n");
}
}
Posted: Mon Nov 29, 2004 9:15 pm
by little joey
Why don't you use formatting tags when posting code? Is much nicer to read.
Print "Case x: can't determine".
I have no clue why they always want us to print those stupid case numbers, but they do, and they're the boss...
Posted: Mon Nov 29, 2004 10:13 pm
by TISARKER
I cann't use formatting tags when posting code?
I want to know it.
Finally I got accpted and I also think it about Boss.
***Its all correct whatever the do/wish.
***Its none correct whatever we do/wish Because we are not Boss.
Posted: Tue Nov 30, 2004 1:15 am
by Adrian Kuegel
little joey wrote:Print "Case x: can't determine".
I have no clue why they always want us to print those stupid case numbers, but they do, and they're the boss...
It helps the judges in a realtime contest with judging (they have to look at your output). Of course it doesn't make much sense in a online contest. But for example I proposed my problem originally for a realtime contest, but it was not used there.
It also helps during the preparation of a contest, if one of the judge solutions is wrong to find the test case.
Posted: Tue Nov 30, 2004 11:01 am
by little joey
Thank you for explaining. It makes sense.
Posted: Sat Dec 18, 2004 3:59 pm
by Niaz
Though I got it accepted still I have some confusion about Straight Crossing. Why the river's velocity is ignored here ? There must be an effect of river's velocity.
For Anupam only : There is a math problem in Tofajjal Sir's Physics Book in HSC Level. At that math, it is shown that a boat can cross a river in two ways (as you said in your problem) and there the velocity of river is considered in both the cases. But the solution for your problem can not work with that problem. Would you please explain this matter clearly. Thanks in advance.

Posted: Mon Dec 20, 2004 7:42 pm
by anupam
Niaz wrote:
For Anupam only : There is a math problem in Tofajjal Sir's Physics Book in HSC Level. At that math, it is shown that a boat can cross a river in two ways (as you said in your problem) and there the velocity of river is considered in both the cases. But the solution for your problem can not work with that problem. Would you please explain this matter clearly. Thanks in advance.

Thanks Niaz for your attention. I had done all the example of all the physics books of HSC level to get chance at CSE, BUET. So, for you only:
(better if I could draw a figure)
There are two vel.s (your boat's and river's). For straight crossing, you should start we angle theta with river's flow direction and ofcourse, theta>90 so that the resultant vel. is in the straight direction. Now, just think, do the vel. of river helps you to cross any distance across the river??? It is only the component of your boat in the vertical direction. The vel. of river helps to pass distances horizontally. So, there is no need for the river's velocity for this case. Am i clear? I am now not regular to board for some days. So, if you need further clarification send me mail at
abrbuet@yahoo.com
Posted: Tue Dec 21, 2004 3:55 am
by Niaz
Anupam,
Thanks for your reply. Actually still I have some confutations (may be that is why I did not get the chance in BUET

). I am going to Malaysia for attending World Universities Debating Championship on 26th December. Insha-Allah I will be beck by 5th of January. Then I will mail you.
Niaz
NB : Though I have confusions, during contest time from my team I attacked this problem and solved it.
Judge Solution Incorrect
Posted: Mon Jan 24, 2005 8:15 am
by rajsekar_manokaran
I kept getting WA when my code checked for `can't determine' like this:
Code: Select all
if (v>=u)
printf ("can't determine\n");
then i changed it to
Code: Select all
if (v>=u || u==0 || v==0)
printf ("can't determine\n");
and got AC
isn't the first one correct?
when v == 0 (the river is still), i can determine the time difference which would turn out to be zero.
10773 Back to Intermediate Math WA,i'm totally confused:(
Posted: Mon Feb 14, 2005 6:45 pm
by Morning
Code: Select all
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main()
{
int N;
double d,v,u;
while(cin >> N)
{
for(int i = 1;i <= N;i++)
{
cin >> d >> v >> u;
if(v == 0 || u == 0 || u <= v) ... else
{
... }
}
}
return 0;
}
a quite simple problem,huh?why do i keep getting WA???
Posted: Tue Feb 15, 2005 12:07 am
by Sanny
if(v == 0 || u == 0 || u <= v) printf("Case %d: can't determine\n",i);
I think v=0 is valid.
Posted: Tue Feb 15, 2005 10:10 am
by Morning
i don't think so.
i've changed my code to if(u == 0 || u <= v) printf("Case %d: can't determine\n",i);
but still got WA

Posted: Tue Feb 15, 2005 3:18 pm
by Morning
i know why i keep getting WA
the input must be weird
i deleted my while(cin >> N) loop and got AC
but i still don't know why
if there's something following the input case ,i should get TLE but not WA
:-?
10773 - WRONG JUDGE'S SOLUTION???
Posted: Sat Feb 26, 2005 4:47 pm
by rimu
this ridiculously easy problem gave me wrong answer for a
week. so, had to look for threads to find what's wrong. what
i've found is really "STUPID

"
i got AC when i used the condition if v ( river's velocity ) == 0
output " can't determine " !!!!!!!!!!!!!!!!!!
could someone who has used the condition( realising its reason )
or better if the problemsetter explain me why i can't
determine the required time difference when the rivers velocity
is zero???????? ( if i'm not wrong ( which is pretty obvious )
in that case shortest path and shortest time would require
the same time and result should be zero )
Posted: Sat Feb 26, 2005 6:05 pm
by little joey
Because that is exactly what is asked:
and then print "can't determine" (without the quotes) if it is not possible to find different paths
If v==0, there is only one path, and not two different paths, so the answer is "can't determine".
Please check carefully if you fully understand the description before you start screaming on the board...