Skip to main content
Commonmark migration
Source Link

##Input

Input

You are given a 2D map with balls and ground in it. It looks like this:

  1         5          2
                 3
     4


__________________________

Each number is a ball, and the _ is ground level. The underscore _ character is not allowed in any other line than ground level line. There are only spaces, newlines and digits 0-9 allowed above ground level. You cannot assume that last line is the ground level - empty lines below ground level are allowed. You can also add spaces, to fill empty lines, if that does help you.

Balls can have numbers from 0 to 9, can be placed above each other, but not under ground. The ball's numbers will be unique.

Assume that each character is one meter.

Get map from pastebin!
Test case 1 - should output something like this
Test case 2 - should produce same results as first map

Challenge

Your challenge is to read a map like that from a file or from stdin — you are allowed to use cat balls.txt | ./yourexecutable — and output velocity of each ball when it hits the ground.

Here's the formula for velocity:

enter image description here

Assume that h is the line number difference between the ground's line number, and the ball's line number, and that g equals 10m/s^2.

Output

You should output each balls number and velocity in m/s at ground level. For example N - Vm/s, where N is ball number and V is its velocity. You can also output an array if you want.

Happy coding! :)

##Input

You are given a 2D map with balls and ground in it. It looks like this:

  1         5          2
                 3
     4


__________________________

Each number is a ball, and the _ is ground level. The underscore _ character is not allowed in any other line than ground level line. There are only spaces, newlines and digits 0-9 allowed above ground level. You cannot assume that last line is the ground level - empty lines below ground level are allowed. You can also add spaces, to fill empty lines, if that does help you.

Balls can have numbers from 0 to 9, can be placed above each other, but not under ground. The ball's numbers will be unique.

Assume that each character is one meter.

Get map from pastebin!
Test case 1 - should output something like this
Test case 2 - should produce same results as first map

Challenge

Your challenge is to read a map like that from a file or from stdin — you are allowed to use cat balls.txt | ./yourexecutable — and output velocity of each ball when it hits the ground.

Here's the formula for velocity:

enter image description here

Assume that h is the line number difference between the ground's line number, and the ball's line number, and that g equals 10m/s^2.

Output

You should output each balls number and velocity in m/s at ground level. For example N - Vm/s, where N is ball number and V is its velocity. You can also output an array if you want.

Happy coding! :)

Input

You are given a 2D map with balls and ground in it. It looks like this:

  1         5          2
                 3
     4


__________________________

Each number is a ball, and the _ is ground level. The underscore _ character is not allowed in any other line than ground level line. There are only spaces, newlines and digits 0-9 allowed above ground level. You cannot assume that last line is the ground level - empty lines below ground level are allowed. You can also add spaces, to fill empty lines, if that does help you.

Balls can have numbers from 0 to 9, can be placed above each other, but not under ground. The ball's numbers will be unique.

Assume that each character is one meter.

Get map from pastebin!
Test case 1 - should output something like this
Test case 2 - should produce same results as first map

Challenge

Your challenge is to read a map like that from a file or from stdin — you are allowed to use cat balls.txt | ./yourexecutable — and output velocity of each ball when it hits the ground.

Here's the formula for velocity:

enter image description here

Assume that h is the line number difference between the ground's line number, and the ball's line number, and that g equals 10m/s^2.

Output

You should output each balls number and velocity in m/s at ground level. For example N - Vm/s, where N is ball number and V is its velocity. You can also output an array if you want.

Happy coding! :)

this is not "Also..." like an afterthought: it's crucial to understanding the preceding sentence
Source Link
msh210
  • 3.5k
  • 21
  • 36

##Input

You are given a 2D map with balls and ground in it. It looks like this:

  1         5          2
                 3
     4


__________________________

Each number is a ball, and the _ is ground level. The underscore _ character is not allowed in any other line than ground level line. There are only spaces, newlines and digits 0-9 allowed above ground level. You cannot assume that last line is the ground level - empty lines below ground level are allowed. You can also add spaces, to fill empty lines, if that does help you.

Balls can have numbers from 0 to 9, can be placed above each other, but not under ground. The ball's numbers will be unique.

Assume that each character is one meter.

Get map from pastebin!
Test case 1 - should output something like this
Test case 2 - should produce same results as first map

Challenge

Your challenge is to read a map like that from a file or from stdin - you are allowed to use cat balls.txt | ./yourexecutable and output velocity of each ball when it hits the ground.

Here's the formula for velocity:

enter image description here

Also, assumeAssume that h is the line number difference between the ground's line number, and the ball's line number, and that g equals 10m/s^2.

Output

You should output each balls number and velocity in m/s at ground level. For example N - Vm/s, where N is ball number and V is its velocity. You can also output an array if you want.

Happy coding! :)

##Input

You are given a 2D map with balls and ground in it. It looks like this:

  1         5          2
                 3
     4


__________________________

Each number is a ball, and the _ is ground level. The underscore _ character is not allowed in any other line than ground level line. There are only spaces, newlines and digits 0-9 allowed above ground level. You cannot assume that last line is the ground level - empty lines below ground level are allowed. You can also add spaces, to fill empty lines, if that does help you.

Balls can have numbers from 0 to 9, can be placed above each other, but not under ground. The ball's numbers will be unique.

Assume that each character is one meter.

Get map from pastebin!
Test case 1 - should output something like this
Test case 2 - should produce same results as first map

Challenge

Your challenge is to read a map like that from a file or from stdin - you are allowed to use cat balls.txt | ./yourexecutable and output velocity of each ball when it hits the ground.

Here's the formula for velocity:

enter image description here

Also, assume that h is the line number difference between the ground's line number, and the ball's line number, and that g equals 10m/s^2.

Output

You should output each balls number and velocity in m/s at ground level. For example N - Vm/s, where N is ball number and V is its velocity. You can also output an array if you want.

Happy coding! :)

##Input

You are given a 2D map with balls and ground in it. It looks like this:

  1         5          2
                 3
     4


__________________________

Each number is a ball, and the _ is ground level. The underscore _ character is not allowed in any other line than ground level line. There are only spaces, newlines and digits 0-9 allowed above ground level. You cannot assume that last line is the ground level - empty lines below ground level are allowed. You can also add spaces, to fill empty lines, if that does help you.

Balls can have numbers from 0 to 9, can be placed above each other, but not under ground. The ball's numbers will be unique.

Assume that each character is one meter.

Get map from pastebin!
Test case 1 - should output something like this
Test case 2 - should produce same results as first map

Challenge

Your challenge is to read a map like that from a file or from stdin you are allowed to use cat balls.txt | ./yourexecutable and output velocity of each ball when it hits the ground.

Here's the formula for velocity:

enter image description here

Assume that h is the line number difference between the ground's line number, and the ball's line number, and that g equals 10m/s^2.

Output

You should output each balls number and velocity in m/s at ground level. For example N - Vm/s, where N is ball number and V is its velocity. You can also output an array if you want.

Happy coding! :)

Tweeted twitter.com/StackCodeGolf/status/746740810952085504
Added expected test cases results
Source Link
Jacajack
  • 511
  • 2
  • 16
Loading
added 18 characters in body
Source Link
DJMcMayhem
  • 59.6k
  • 17
  • 196
  • 348
Loading
Update rules
Source Link
Jacajack
  • 511
  • 2
  • 16
Loading
More rules
Source Link
Jacajack
  • 511
  • 2
  • 16
Loading
Add test cases
Source Link
Jacajack
  • 511
  • 2
  • 16
Loading
added 57 characters in body
Source Link
Jacajack
  • 511
  • 2
  • 16
Loading
Units
Source Link
Jacajack
  • 511
  • 2
  • 16
Loading
Clarify rules
Source Link
Jacajack
  • 511
  • 2
  • 16
Loading
edited tags
Link
xnor
  • 146.6k
  • 26
  • 279
  • 652
Loading
Update rules a bit
Source Link
Jacajack
  • 511
  • 2
  • 16
Loading
Source Link
Jacajack
  • 511
  • 2
  • 16
Loading