Recent

Author Topic: Interesting problem... even more interesting solution  (Read 491 times)

440bx

  • Hero Member
  • *****
  • Posts: 4732
Interesting problem... even more interesting solution
« on: November 27, 2024, 02:49:11 am »
Hello,

What follows is, at best, only indirectly related to Pascal or programming in that it tests one's abilities to visualize solutions to a problem.

The problem is one given to elementary school children in China.  It is presented in youtube. Link: https://www.youtube.com/watch?v=3g8voItQD0c

I invite those interested in problem solving to take a crack at it.

For the record, I did solve the problem but not the way I would have liked to have solved it.

Have fun!


(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

MathMan

  • Sr. Member
  • ****
  • Posts: 405
Re: Interesting problem... even more interesting solution
« Reply #1 on: November 27, 2024, 09:09:59 am »
Being the show-off that I am I posted my solution here initially, sorry  :-[

Just for the record - I solved it too, mathematically, as I usually do.
« Last Edit: November 27, 2024, 09:22:29 am by MathMan »

Thaddy

  • Hero Member
  • *****
  • Posts: 16174
  • Censorship about opinions does not belong here.
Re: Interesting problem... even more interesting solution
« Reply #2 on: November 27, 2024, 10:59:09 am »
This is an elementary school problem. What's the fuzz?
If I smell bad code it usually is bad code and that includes my own code.

440bx

  • Hero Member
  • *****
  • Posts: 4732
Re: Interesting problem... even more interesting solution
« Reply #3 on: November 27, 2024, 02:54:15 pm »
Just for the record - I solved it too, mathematically, as I usually do.
That's how I solved it too but the really beautiful solution, which he gives at the end, I missed.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 16174
  • Censorship about opinions does not belong here.
Re: Interesting problem... even more interesting solution
« Reply #4 on: November 27, 2024, 04:17:24 pm »
Did I miss something in removing the noise? Took less than two seconds to solve it when I knew the constants and the length of the video.
The Chinese are right.
If I smell bad code it usually is bad code and that includes my own code.

 

TinyPortal © 2005-2018