|
-
Apr 8th, 2000, 02:00 PM
#1
Thread Starter
Conquistador
Could someone help me with this please:
Two trains, both 200 metres long, travel on parallel tracks through a tunnel. One travels at 100 KM/h, the other at 200 KM/h. The front of the fast train enters the tunnel just as it passes the back of the slow train. The back of the fast train leaves the tunnel just as it passes the front of the slow train. How long is the tunnel?
Thanks for taking a look!
-
Apr 8th, 2000, 06:41 PM
#2
Junior Member
800m long. The fast train has to travel 400m (200m + 200m) to totally overtake the slow train. The slow train (while the fast train is travelling 400m) goes 200m. So after 400m they are parallel. If the fast train goes another 400m, and the slow train goes 200m, then the fast train is in the correct position (at the end of the tunnel). So 400m + 400m = 800m. The tunnel is 800m long.
-
Apr 8th, 2000, 06:41 PM
#3
transcendental analytic
(x+200)/200=(x-200)/100
x=600m
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 8th, 2000, 06:45 PM
#4
transcendental analytic
Eh, Am I wrong? Or who is?
___(TrainFast)|(trainslow)_____________Tunnel___________(Trainslow)|(trainfast)_____________________ _
where the | marks tunnel entrance and exit. Is this so?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 8th, 2000, 06:45 PM
#5
Junior Member
I would hate to seem aggressive, kedaman, BUT IT'S 800 *~/#ing metres long.
-
Apr 8th, 2000, 06:49 PM
#6
transcendental analytic
I put tunnel length to x, so fasttrain travels x+200 and slowtrain x-200. then i used the s=vt where t1=t2 wich means that s1/v1 = s2=v2. witch means (x+200)/200=(x-200)/100
x=600. Have I done something wrong?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 8th, 2000, 07:02 PM
#7
Junior Member
The thing is, kedaman, that the fast train has to travel 400m (if the slow train were not to be moving) to overtake:
Key:
******************
_ Railtracks
>>>>> Fast train
<<<<< Slow train
******************
After 0m:
>>>>>_____
_____<<<<<
After 200m:
______>>>>>
______<<<<<
After 400m:
___________>>>>>
______<<<<<
So, if we add to the equation the fact that the slow train is moving, the train has to travel twice as far (because it is only making up half the distance as it is in the illustration). So 400 * 2 = 800m.
-
Apr 8th, 2000, 09:18 PM
#8
Hyperactive Member
I think kedaman is correct.
Hi.
1. As the fast train enters the tunnle the front of the slow train is 200 meters into the tunnel. (1 slow train length.)
2. When the fast train has traveled 400 meters and is even with the slow train, the slow train has traveled 200 meters. The front of the slow train is now 400 meters into the tunnel. (2 slow train lengths.)
3. When the fast train has traveled another 400 meters the end of the fast train is passing the front of the slow train. The slow train has traveled another 200 meters. The front of the slow train is now at the end of the tunnel. (3 slow train lengths.)
Al.
A computer is a tool, not a toy.
-
Apr 8th, 2000, 09:52 PM
#9
Lively Member
-
Apr 8th, 2000, 09:56 PM
#10
Hyperactive Member
-
Apr 8th, 2000, 11:30 PM
#11
transcendental analytic
OK,
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 9th, 2000, 01:02 AM
#12
Junior Member
I see where I've gone wrong
OK. I must say I'm not 100% sure on this, but I'll still give it a go:
As the fast train enters the tunnel, it is 200m behind the slow train. After the fast train has travelled 200m, the slow train has gone 100m, so the fast train is still 100m behind. After the fast train has gone another 200m, the slow train has also gone 100m, so they are now parallel, agreed?
Then the fast train goes 200m, but the slow train is still 100m behind. Once the fast train has gone another 200m, the slow train has gone 100m, but it is 200m behind all the same, so this must be where the end of the tunnel is. If we add up all of the 200m we get how far the fast train went (800m) but (and this is where I went embarrassingly wrong and forgot to do), the fast train is 200m farther away than the end of the tunnel so we must take away 200m to leave 600m. I'm sorry about that. Sorry, kedaman.

But it is nice to have an argument.
Except I usually lose.
Pathetic, really...
-
Apr 9th, 2000, 03:32 AM
#13
transcendental analytic
I guess there was a missunderstanding the text or something, thats all, Philosopher, youre thinking great. Im not sure if that sentence is a lie or not, heh
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 9th, 2000, 07:14 AM
#14
Frenzied Member
Note Actual velocity does not matter
600 Meters is correct, but Kederman's equation are technically incorrect due to assuming velocities of 200 & 100 meters per hour, not 200 & 100 Kilometers per hour. His result is correct because it is the relative velocity of the two trains which matters. Nobody seems to have noticed this aspect of the problem. Check examples below.
At 200 meters per hour, front end of fast train would go 800 meters in four hours (from start of tunnel to 200 meters beyond the end of 600 meter tunnel). In the same four hours (@ 100 meters per hour) front end of slow train goes 400 meters: It starts 200 meters into tunnel and gets to end (400 meters away)in 4 hours.
If trains went 200 % 100 meters per second (3600 time faster) the following would occur. Front of fast train goes the 800 meters in 4 seconds instead of 4 hours, while front of slow train goes 400 meters in 4 seconds. In actual problem the speeds of 200 & 100 Kolometers per hour are intermediate to the examples just described.
The dinosaur (me) is old, but not too dumb.
-
Apr 9th, 2000, 01:35 PM
#15
Thread Starter
Conquistador
Another Question
ok, thanks for that one
now i have another one, which is due in soon
The postcode on an envelope is a four-digit number. The sum of the digits is even. The first two digits form a two-digit number divisible by 9. The first and third form the square of a whole number, and the second and fourth form a multiple of 11. What is the postcode?
So far I have this:
Let x = the post code
So x = abcd
So a+b+c+d / 2 = 0
And ab / 9 = 0
Possibilities for ab
9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99
And ac could be one of 1(1), 4(2), 9(3), 16(4), 25(5), 36(6), 49(7), 64(8) and 81(9)
And bd / 11 = 0
Possibilities for ac
11, 22, 33, 44, 55, 66, 77, 88, 99
There must be an even amount of the same type of digits.
For Example:
if
a is odd
b is even
c is odd
then
d has to be even
OK?
Thanks
-
Apr 9th, 2000, 03:53 PM
#16
Lively Member
The solution should be 6343:
6 + 3 + 4 + 3 = 16
63 MOD 9 = 0
SQR(64)= 8
33 MOD 11 = 0
Code:
Private Sub Form_Load()
Dim a, b, c, d, n As Integer
For a = 1 To 9
For b = 0 To 9
For c = 0 To 9
For d = 0 To 9
For n = 1 To 9
If (((a + b + c + d)) Mod 2 = 0) And _
((10 * a + b) Mod 9 = 0) And _
((10 * b + d) Mod 11 = 0) And _
((10 * a + c) = n ^ 2) Then
Text1 = Text1 & (a & b & c & d & "; ")
End If
Next n
Next d
Next c
Next b
Next a
End Sub
[Edited by Nina on 04-10-2000 at 05:37 AM]
-
Apr 9th, 2000, 03:57 PM
#17
transcendental analytic
OK, here we go 
Code:
Private Sub Form_Load()
For n = 0 To 9999
a = Int(n / 1000)
b = Int(n / 100) Mod 10
c = Int(n / 10) Mod 10
d = n Mod 10
If (a + b + c + d) Mod 2 = 0 Then
If (a * 10 + b) Mod 9 = 0 Then
If Sqr(a * 10 + c) = Int(Sqr(a * 10 + c)) Then
If (b * 10 + d) Mod 11 = 0 Then
If ((a Mod 2) + (b Mod 2) + (c Mod 2) + (d Mod 2)) Mod 2 = 0 Then
Debug.Print Format(n, "0000")
End If
End If
End If
End If
End If
Next n
End Sub
'0000
'0040
'0909
'0949
'6343
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 9th, 2000, 06:02 PM
#18
Junior Member
It's 6343. I haven't worked it out; (I'm just copying kedaman's answer), but I'm sure it's right.
(I'll screw up again if I try to find an answer of my own)

[Edited by Philosopher on 04-10-2000 at 02:41 AM]
-
Apr 9th, 2000, 07:02 PM
#19
Addicted Member
You're only cheating yourself by getting everyone else to do your homework. Trust me when I say this because when you get into the real world of computer programming you're going to need this kind of problem solving skill to be successful.
-
Apr 13th, 2000, 12:57 AM
#20
Hyperactive Member
explain...
Ok,
Someone explain. Where'd 6346 come from? What unit is that?
Thanks.
-
Apr 13th, 2000, 01:14 AM
#21
Frenzied Member
There is no unit, it's a pure number.
If you look at the first page of this thread, you'll see that there was a second question, which required you to find a four digit number which would comply with certain rules. Basically these guys are just using a repetitive process with the computer to find the result, although the idea of the question may well have been to find the answer using algebraic techniques. It's much easier to let the computer do the work though
Harry.
"From one thing, know ten thousand things."
-
Apr 13th, 2000, 02:20 AM
#22
Frenzied Member
Without using a computer....
Well I decided to work it out myself, so here's my solution.
So we know:
A+B+C+D is evenB&D is a multiple of 11
A&B is divisible by 9
A&C is the square of an integer
So, from thi we can infer:
A+B+C+D mod 2 = 0
B=D since any multiple of 11 less than 100 has two digits the same
A&B mod 9 = 0
B&D mod 11 = 0
sqr(A&C) is in the range 4<=A&C<=9 since A&C is a two digit number
Now, since B=D and A+B+C+D is even
B+D is even, therefore
If B is odd, D is odd
If B is even, D is even
This implies that:
A+C is even, therefore
If A is odd, C is odd
If A is even, C is even
since the sum of an odd and an even number will always be odd.
The sum of A+C and B+D must be even according to the stated conditions
so
(A+C) mod 2 = (B+D) mod 2
Now, since A&C is in the set {16, 25, 36, 49, 64, 81} and we know that A+C is even,
we can infer that A&C cannot be in the set {25, 36, 49, 81} since for those values of
A&C, A+C is odd. This contradicts the logic we established just now.
This means that A&C must be in the set {16, 64}
So A=1, C=6
OR
A=6, C=4
Now, we know that A&B is a factor of 9.
Therefore A&B must be in the range
10<=A&B<=19 if A=1
OR
60<=A&B<=69 if A=6
If A=1 and (A&B mod 9)=0 then
A&B must be 18
If A=6 and (A&B mod 9)=0 then
A&B must be 63
So we have either:
(1) A=1, B=8, C=6
OR
(2) A=6, B=3, C=4
Now, we know B=D and (A+B+C+D mod 2)=0 (A+B+C+D is even)
CASE (1):
A=1, B=8, C=6, D=8
A+B+C+D=23 ODD
So we reject case (1)
CASE (2):
A=6, B=3, C=4, D=3
A+B+C+D=16 EVEN
So we accept case (2)
Therefore the only possible 4 digit number to satisfy the stated conditions is:
6343
[Edited by HarryW on 04-13-2000 at 08:26 PM]
Harry.
"From one thing, know ten thousand things."
-
Apr 13th, 2000, 02:33 AM
#23
Fanatic Member
-
Apr 13th, 2000, 02:50 AM
#24
Frenzied Member
Well yeah, it's faster using the computer, but it's, well.... too easy 
Harry.
"From one thing, know ten thousand things."
-
Apr 13th, 2000, 03:14 AM
#25
Frenzied Member
well I got 6343 in a matter of seconds just by looking at everyone elses answers.
-
Apr 13th, 2000, 09:41 PM
#26
Fanatic Member
Go Sam...
Now Sam's method is by far the easiest and fastest. Don't we agree, class?
[Not Edited by V(ery) Basic on 00:00 04/12/00]
-
Apr 13th, 2000, 10:52 PM
#27
Fanatic Member
Could someone help me with this please:
Two trains, both 200 metres long, travel on parallel tracks through a tunnel. One travels at 100 KM/h, the other at 200 KM/h. The front of the fast train enters the tunnel just as it passes the back of the slow train. The back of the fast train leaves the tunnel just as it passes the front of the slow train. How long is the tunnel?
Thanks for taking a look!
This will give you 600.000277767334m in 14.400009999624 seconds
Code:
Private Sub Command1_Click()
Dim train1 As Double ' 100kmph train
Dim train2 As Double ' 200kmph train
Dim Timed As Double
Time = 0
train1 = 0
train1 = train2 + 200
While train2 < train1 + 200
' check each 100,000th second
Timed = Timed + 0.00001
train2 = train2 + 5.555555555555E-04 ' 200kmh as m/100,000th of a sec
train1 = train1 + 2.777777777778E-04 ' 100kmh as m/100,000th of a sec
Wend
Timed = (Timed * 27.7777777777778) + 200
Label1.Caption = "Less than or equal to " & Timed
End Sub
[Edited by Paul282 on 04-14-2000 at 12:30 PM]
-
Apr 13th, 2000, 11:05 PM
#28
Fanatic Member
kedaman's method was more efficient
On my system
kedaman = 0.11 sec
nina = 0.56 sec
could be a big difference in a larger brute force algorithm...
Anyone beat that ??????????? 
-
Apr 13th, 2000, 11:20 PM
#29
Fanatic Member
Ok, I'm bored I admit it...
but check this out, just but declaring the vars as LONGs I get 10x the performance gain (note that the last two are both kadamans algorithm with and without strong type!)
paste this with a button and a label on a form !!!
Code:
Public Tim As Double
Private Sub Command1_Click()
Tim = Timer
Dim a, b, c, d, n As Integer
For a = 1 To 9
For b = 0 To 9
For c = 0 To 9
For d = 0 To 9
For n = 1 To 9
If (((a + b + c + d)) Mod 2 = 0) And _
((10 * a + b) Mod 9 = 0) And _
((10 * b + d) Mod 11 = 0) And _
((10 * a + c) = n ^ 2) Then
Text1 = Text1 & (a & b & c & d & "; ")
End If
Next n
Next d
Next c
Next b
Next a
Label1.Caption = Format(Timer - Tim, "0.000000000")
End Sub
Private Sub Command2_Click()
Tim = Timer
For n = 0 To 9999
a = Int(n / 1000)
b = Int(n / 100) Mod 10
c = Int(n / 10) Mod 10
d = n Mod 10
If (a + b + c + d) Mod 2 = 0 Then
If (a * 10 + b) Mod 9 = 0 Then
If Sqr(a * 10 + c) = Int(Sqr(a * 10 + c)) Then
If (b * 10 + d) Mod 11 = 0 Then
If ((a Mod 2) + (b Mod 2) + (c Mod 2) + (d Mod 2)) Mod 2 = 0 Then
Debug.Print Format(n, "0000")
End If
End If
End If
End If
End If
Next n
Label1.Caption = Format(Timer - Tim, "0.000000000")
End Sub
Private Sub Command3_Click()
Tim = Timer
Dim n As Long
Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Long
For n = 0 To 9999
a = CLng(n / 1000)
b = CLng(n / 100) Mod 10
c = CLng(n / 10) Mod 10
d = n Mod 10
If (a + b + c + d) Mod 2 = 0 Then
If (a * 10 + b) Mod 9 = 0 Then
If Sqr(a * 10 + c) = Int(Sqr(a * 10 + c)) Then
If (b * 10 + d) Mod 11 = 0 Then
If ((a Mod 2) + (b Mod 2) + (c Mod 2) + (d Mod 2)) Mod 2 = 0 Then
Debug.Print Format(n, "0000")
End If
End If
End If
End If
End If
Next n
Label1.Caption = Format(Timer - Tim, "0.000000000")
End Sub
[Edited by Paul282 on 04-14-2000 at 12:21 PM]
-
Apr 14th, 2000, 01:47 AM
#30
transcendental analytic
This will give you 600.000277767334m in 14.400009999624 seconds
Using Doubles which are floating points gives you only an approximate value. The correct one is still 600m
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 14th, 2000, 02:38 AM
#31
Fanatic Member
The mind is more efficient than the machine...
This time, by using the computer you take longer and
it is less accurate. (Algebra would give you 600m
exactly).
I just thought I'd make that totally useless point.
I'll go then...
Bye..
See ya..
[Oh just b*gger off you ugly piece of dung beetle excrement]
OK. OK. I'm going...
[P*ss the *1$@ off]
See ya!
-
Apr 15th, 2000, 07:00 AM
#32
Thread Starter
Conquistador
Thank you all very much for your help.
Source Code for VB projects is nice, but I think my Teacher would prefer Mental Arithmetic...
I have two more for you and that will be all 
For the first one, I have an answer ok...
A boy in a class of 9 students tells the teacher that the school bus broke down. A girl in the class says that the boy is lying, then another boy says the girl is telling the truth, another girl says the second boy is lying and so on, each girl saying the previous boy is lying and each boy saying the previous girl is telling the truth. Exactly 4 of the students are lying. Did the school bus break down or not?
MY SOLUTION
Let 1b = 1st Boy, 2b = 2nd Boy etc.
Let 1g = 1st Girl, 2g = 2nd Girl etc.
Let * mark the people think 1b is lying.
1b says School Bus broke down
1g says 1b is lying *
2b says 1g is telling the truth *
2g says 2b is lying
3b says 2g is telling the truth
3g says 3b is lying *
4b says 3g is telling the truth *
4g says 4b is lying
5b says 4g is telling the truth
So the 4 * people are lying.
Therefore the bus did break down.
What do you guys think??
2nd Problem
From the time Amanda gets up until her bus leaves at 8 a.m., she uses one seventh of the time having a shower, then one sixth of the remaining time getting dressed, and then one quarter of the remaining time to have breakfast, which she finishes at exactly 7.15 a.m. At what time does she get up?
PLEASE HELP...
-
Apr 15th, 2000, 09:51 AM
#33
Hyperactive Member
Question 2
Took me a while to get this, but consider the following:
(1/7)x + (6/7)*(1/6)x + (5/7)*(1/4)x + 45 = x
where x is the time it took.
solve it down to
45 = x - (13/28)x
then x = 84 minutes.
thus, she got up at 6:36
bob
-
Apr 16th, 2000, 06:54 AM
#34
Frenzied Member
Hoorah! See V(ery) Basic, I did something useful!
Harry.
"From one thing, know ten thousand things."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|