10773 - Back to Intermediate Math
Moderator: Board moderators
10773 - Back to Intermediate Math
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");
}
}
#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");
}
}
Last edited by TISARKER on Sat Dec 18, 2004 4:32 pm, edited 2 times in total.
Mr. Arithmetic logic Unit
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
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.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 also helps during the preparation of a contest, if one of the judge solutions is wrong to find the test case.
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
-
- Learning poster
- Posts: 77
- Joined: Fri Dec 17, 2004 11:06 am
- Location: East West University, Dhaka, Bangladesh
- Contact:
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.![:)](./images/smilies/icon_smile.gif)
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.
![:)](./images/smilies/icon_smile.gif)
Please join The ACM Solver Group at Yahoo
http://groups.yahoo.com/group/acm_solver/
http://groups.yahoo.com/group/acm_solver/
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: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.
(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
"Everything should be made simple, but not always simpler"
-
- Learning poster
- Posts: 77
- Joined: Fri Dec 17, 2004 11:06 am
- Location: East West University, Dhaka, Bangladesh
- Contact:
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.
Thanks for your reply. Actually still I have some confutations (may be that is why I did not get the chance in BUET
![:(](./images/smilies/icon_frown.gif)
Niaz
NB : Though I have confusions, during contest time from my team I attacked this problem and solved it.
Please join The ACM Solver Group at Yahoo
http://groups.yahoo.com/group/acm_solver/
http://groups.yahoo.com/group/acm_solver/
-
- New poster
- Posts: 9
- Joined: Fri Feb 20, 2004 6:48 am
- Location: India
- Contact:
Judge Solution Incorrect
I kept getting WA when my code checked for `can't determine' like this:
then i changed it to
and got AC ![:lol:](./images/smilies/icon_lol.gif)
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.
Code: Select all
if (v>=u)
printf ("can't determine\n");
Code: Select all
if (v>=u || u==0 || v==0)
printf ("can't determine\n");
![:lol:](./images/smilies/icon_lol.gif)
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:(
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;
}
Last edited by Morning on Tue Feb 15, 2005 3:25 pm, edited 1 time in total.
"Learning without thought is useless;thought without learning is dangerous."
"Hold what you really know and tell what you do not know -this will lead to knowledge."-Confucius
"Hold what you really know and tell what you do not know -this will lead to knowledge."-Confucius
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
:-?
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
:-?
"Learning without thought is useless;thought without learning is dangerous."
"Hold what you really know and tell what you do not know -this will lead to knowledge."-Confucius
"Hold what you really know and tell what you do not know -this will lead to knowledge."-Confucius
10773 - WRONG JUDGE'S SOLUTION???
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 )
week. so, had to look for threads to find what's wrong. what
i've found is really "STUPID
![:evil:](./images/smilies/icon_evil.gif)
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 )
i'll be back
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
Because that is exactly what is asked:
Please check carefully if you fully understand the description before you start screaming on the board...
If v==0, there is only one path, and not two different paths, so the answer is "can't determine".and then print "can't determine" (without the quotes) if it is not possible to find different paths
Please check carefully if you fully understand the description before you start screaming on the board...