10773 - Back to Intermediate Math

All about problems in Volume 107. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

10773 - Back to Intermediate Math

Post 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");
}

}
Last edited by TISARKER on Sat Dec 18, 2004 4:32 pm, edited 2 times in total.
Mr. Arithmetic logic Unit
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post 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...
TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

Post 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.
Mr. Arithmetic logic Unit
Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Post 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.
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

Thank you for explaining. It makes sense.
Niaz
Learning poster
Posts: 77
Joined: Fri Dec 17, 2004 11:06 am
Location: East West University, Dhaka, Bangladesh
Contact:

Post 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. :)
Please join The ACM Solver Group at Yahoo
http://groups.yahoo.com/group/acm_solver/
anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post 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
"Everything should be made simple, but not always simpler"
Niaz
Learning poster
Posts: 77
Joined: Fri Dec 17, 2004 11:06 am
Location: East West University, Dhaka, Bangladesh
Contact:

Post 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.
Please join The ACM Solver Group at Yahoo
http://groups.yahoo.com/group/acm_solver/
rajsekar_manokaran
New poster
Posts: 9
Joined: Fri Feb 20, 2004 6:48 am
Location: India
Contact:

Judge Solution Incorrect

Post 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 :lol:

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.
Morning
Experienced poster
Posts: 134
Joined: Fri Aug 01, 2003 2:18 pm
Location: Shanghai China

10773 Back to Intermediate Math WA,i'm totally confused:(

Post 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???
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
Sanny
Learning poster
Posts: 78
Joined: Sat Feb 14, 2004 3:59 pm
Location: BUET
Contact:

Post by Sanny »

if(v == 0 || u == 0 || u <= v) printf("Case %d: can't determine\n",i);
I think v=0 is valid.
Morning
Experienced poster
Posts: 134
Joined: Fri Aug 01, 2003 2:18 pm
Location: Shanghai China

Post 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 :cry:
"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
Morning
Experienced poster
Posts: 134
Joined: Fri Aug 01, 2003 2:18 pm
Location: Shanghai China

Post 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
:-?
"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
rimu
New poster
Posts: 9
Joined: Sat Feb 26, 2005 4:41 pm

10773 - WRONG JUDGE'S SOLUTION???

Post 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 :evil: "

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
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post 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...
Post Reply

Return to “Volume 107 (10700-10799)”