Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#CJam, (削除) 116 106 99 84 77 (削除ここまで) 72 bytes

CJam, (削除) 116 106 99 84 77 (削除ここまで) 72 bytes

l:X;93,72>{:D;OOXS/{S+_2$+,D<{+}{@@);a+\}?}/a+}%{z'K*S/:!0a/1fb$W=}0ドル=N*

Takes the single line input and prints the correct output to STDOUT.

UPDATE : Improved a lot and removed redundant loops by doing all calculations in the sorting loop itself. Also fixed a bug in river length calculation.

Explanation soon (after I golf it even further)

Try it here

#CJam, (削除) 116 106 99 84 77 (削除ここまで) 72 bytes

l:X;93,72>{:D;OOXS/{S+_2$+,D<{+}{@@);a+\}?}/a+}%{z'K*S/:!0a/1fb$W=}0ドル=N*

Takes the single line input and prints the correct output to STDOUT.

UPDATE : Improved a lot and removed redundant loops by doing all calculations in the sorting loop itself. Also fixed a bug in river length calculation.

Explanation soon (after I golf it even further)

Try it here

CJam, (削除) 116 106 99 84 77 (削除ここまで) 72 bytes

l:X;93,72>{:D;OOXS/{S+_2$+,D<{+}{@@);a+\}?}/a+}%{z'K*S/:!0a/1fb$W=}0ドル=N*

Takes the single line input and prints the correct output to STDOUT.

UPDATE : Improved a lot and removed redundant loops by doing all calculations in the sorting loop itself. Also fixed a bug in river length calculation.

Explanation soon (after I golf it even further)

Try it here

deleted 2 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 67
  • 144

#CJam, (削除) 116 106 99 84 77 (削除ここまで) 7772 bytes

l:X;93,72>{:D;OOXS/{S+_2$+,D<{+}{@@);a+\}?}/a+}%{z{Sz'K*S/1>W<:!0a/~}%1fb$W=1fb$W=}0ドル=N*

Takes the single line input and prints the correct output to STDOUT.

UPDATE : Improved a lot and removed redundant loops by doing all calculations in the sorting loop itself. Also fixed a bug in river length calculation.

Explanation soon (after I golf it even further)

Try it here

#CJam, (削除) 116 106 99 84 (削除ここまで) 77 bytes

l:X;93,72>{:D;OOXS/{S+_2$+,D<{+}{@@);a+\}?}/a+}%{z{S/1>W<:!0a/~}%1fb$W=}0ドル=N*

Takes the single line input and prints the correct output to STDOUT.

UPDATE : Improved a lot and removed redundant loops by doing all calculations in the sorting loop itself. Also fixed a bug in river length calculation.

Explanation soon (after I golf it even further)

Try it here

#CJam, (削除) 116 106 99 84 77 (削除ここまで) 72 bytes

l:X;93,72>{:D;OOXS/{S+_2$+,D<{+}{@@);a+\}?}/a+}%{z'K*S/:!0a/1fb$W=}0ドル=N*

Takes the single line input and prints the correct output to STDOUT.

UPDATE : Improved a lot and removed redundant loops by doing all calculations in the sorting loop itself. Also fixed a bug in river length calculation.

Explanation soon (after I golf it even further)

Try it here

deleted 4 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 67
  • 144

#CJam, (削除) 116 106 99 84 (削除ここまで) 8477 bytes

l:X;93,72>{:D;Q:OXSD;OOXS/Sf+{_O+S+_2$+,D<{O\++}{\O@@);a+\}?:O;}/Oa+a+}%{z{S/1>W<:!0a/~}%1fb$W=}0ドル=N*

Takes the single line input and prints the correct output to STDOUT.

UPDATE : Improved a lot and removed redundant loops by doing all calculations in the sorting loop itself. Also fixed a bug in river length calculation.

Explanation soon (after I golf it even further)

Try it here

#CJam, (削除) 116 106 99 (削除ここまで) 84 bytes

l:X;93,72>{:D;Q:OXS/Sf+{_O+,D<{O\+}{\O);a+\}?:O;}/Oa+}%{z{S/1>W<:!0a/~}%1fb$W=}0ドル=N*

Takes the single line input and prints the correct output to STDOUT.

UPDATE : Improved a lot and removed redundant loops by doing all calculations in the sorting loop itself. Also fixed a bug in river length calculation.

Explanation soon (after I golf it even further)

Try it here

#CJam, (削除) 116 106 99 84 (削除ここまで) 77 bytes

l:X;93,72>{:D;OOXS/{S+_2$+,D<{+}{@@);a+\}?}/a+}%{z{S/1>W<:!0a/~}%1fb$W=}0ドル=N*

Takes the single line input and prints the correct output to STDOUT.

UPDATE : Improved a lot and removed redundant loops by doing all calculations in the sorting loop itself. Also fixed a bug in river length calculation.

Explanation soon (after I golf it even further)

Try it here

added 49 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 67
  • 144
Loading
added 147 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 67
  • 144
Loading
deleted 4 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 67
  • 144
Loading
added 1 character in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 67
  • 144
Loading
deleted 2 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 67
  • 144
Loading
deleted 6 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 67
  • 144
Loading
Source Link
Optimizer
  • 26.6k
  • 7
  • 67
  • 144
Loading

AltStyle によって変換されたページ (->オリジナル) /