Gravitational Numbers (Assignment) | SoloLearn: Learn to code for FREE!

+12

Gravitational Numbers (Assignment)

Gravitational Numbers. Numbers have mass and gravitate towards one another. Choosing 2 random numbers in the range of (0-9) compare them side by side above and below as follows. (<<) = Mass to left is greater. (>>) = Mass to Right is greater. (><) = Mass is equal both sides. (0) = Blackhole all surrounding mass gravitates towards this. Please see example. Input 3x3. Output: 5 >> 6 >> 0 v v v v v ^ 7 >> 9 >> 0 ^ ^ ^ ^ ^ ^ 1 >< 1 >> 8 Thanks

4/15/2018 7:31:42 AM

D_Stark

7 Answers

New Answer

+13

https://code.sololearn.com/clpAuvgkAomy/?ref=app

+9

Great Challenge https://code.sololearn.com/cwM5hp6MRbeL/?ref=app

+7

@Coming In Second haha i nearly believed you, i thought that was written with python at first 😂

+3

Thanks for the interesting challenge. I really like the idea to have 0 as a "breaker" of usual comparison rule, however I implemented a trick to still keep them simple. Here is my solution: https://code.sololearn.com/cWGD0VkqgD8c/?ref=app By the way, do you plan to publish an extended version with numbers of several digits length? :-)

+1

On-liner, class challenge{ public static void main(String[ ] args){ System.out.print("5>>6>>0\nv v v\nv v ^\n7>>9>>0\n^ ^ ^\n^ ^ ^\n1><1>>8");} } Haha

+1

D_Stark XD sorry I know there is no room for puns, but it technically is just a onliner of your example haha

+1

Well, here it is - the extended version of the challenge that operates with numbers of any length: https://www.sololearn.com/Discuss/1226683/?ref=app Have fun!