[Question] Mathematics × Programming Competition #3 [問題] 數學 × 程式編寫比賽 (第三回)

in #contest7 years ago (edited)

Welcome to the Mathematics × Programming Competition #3

For Chinese version please scroll to the bottom. 中文版請見文末。


Question

Ghost Leg (aka Amidakuji) is a tiny game which is used to create random pairings between two arrays. This is commonly used in lucky draws.

A ghost leg consists of vertical lines and horizontal lines. If there are N elements in an array, there would be N vertical lines and any number of horizontal lines. Horizontal lines should be touching two adjacent vertical lines. The rule of matching is by picking a vertical line at the top, and go downwards until you hit a horizontal line. Whenever you hit a horizontal line, travel along that horizontal line. Then continue to go downwards and repeat this process until you reach the other end.


Consider this example on the left.

Obviously when there are no horizontal lines at all, the matched pairs would be {A,1}, {B,2} and {C,3}.

With the horizontal lines added, the matched pairs become {A,3}, {B,2} and {C,1}.

Make sure you understand this example before proceeding to the main question :)

Here comes the question. Consider the case N = 10. Given that when there are no horizontal lines, the matching pairs are {A,1}, {B,2}, {C,3}, {D,4}, {E,5}, {F,6}, {G,7}, {H,8}, {I,9}, {J,10}. What is the minimum number of horizontal lines to be added such that the final outcome would be {A,7}, {B,4}, {C,3}, {D,9}, {E,2}, {F,8}, {G,1}, {H,6}, {I,10}, {J,5}?


Answer submission

Please submit your answer through this link.


Rules

  • This competition will last for 24 hours. After that no more submission would be accepted.
  • Participants who submit the answer as a comment below this post will be disqualified.
  • Participants can submit for unlimited number of times, however only the latest answer will be considered.
  • You have to upvote this post AND the announcement post in order to be eligible for the competition.

Prizes

  • The final SBD payout of the announcement post would be the prize pool.
  • The first and second participant who gave the correct numerical answer will get 30% and 20% of the prize pool respectively. 5 other participants who provided the correct answer will be randomly drawn regardless of their submission time and each of them will get 10% of the prize pool.
  • Those who resteemed this post or the announcement post will have 400% higher chance to win in the lucky draw!
  • If not all prizes are given out, they will be accumulated for the next competition.
  • @kenchung reserve all the rights to disqualify any suspected cheating players and decide the distribution of prize among the winner(s).


歡迎參加數學 × 程式編寫比賽 (第三回)


問題

畫鬼腳 是一個用以將兩個序列配對的小遊戲。畫鬼腳被經常應用在抽獎之中。

鬼腳圖由直線及橫線組成。若一序列有N個項目,該鬼腳圖則共有N條直線及任何數量的橫線,且橫線必須連著相鄰的直線。配對規則為選取其中一個頂點,然後向下移動,直至遇到橫線。遇到橫線的時候需要跟著橫線行走,然後繼續向下移動,並重覆以上步驟,直至到達另一端。




試參考左側例子。

當圖中完全沒有橫線,明顯地配對結果為 {A,1}、{B,2}及{C,3}。

加上橫線後,配對結果便變成 {A,3}、{B,2}及{C,1}。

繼續閱讀問題前請確保你已完全明白這個例子 :)


現在終於來到問題部分了。考慮N = 10。已知當鬼腳圖中完全沒有橫線,配對結果為 {A,1}, {B,2}, {C,3}, {D,4}, {E,5}, {F,6}, {G,7}, {H,8}, {I,9}, {J,10}。求最少需要加上的橫線數目使得配對結果為 {A,7}, {B,4}, {C,3}, {D,9}, {E,2}, {F,8}, {G,1}, {H,6}, {I,10}, {J,5}。


答案提交

請經此連結提交答案。


規則

  • 此比賽將進行24小時,其後將不會再接受新答案。
  • 嚴禁在回覆公開答案,否則將被取消資格。
  • 參加者可以重覆提交答案,但比賽終結時只會考慮最後提交的答案。
  • 你必須upvote此帖以及 預告帖方能參加比賽。

獎品

  • 預告帖所獲的SBD獎勵將會用作是次比賽的獎池。
  • 第一及第二名最快給出正確數字答案的參賽者將分別獲得獎池的30%及20%。其他提交了正確數字答案的參與者之中將隨機抽出5名,他們每人可獲10%的獎池。
  • Resteem此帖文或 預告帖者將有額外400%的得獎機會!
  • 若有獎金未被發放,將累積至下一次比賽的獎池。
    本人保留一切最終權利,包括但不限於取消任何疑似作弊者的資格並決定獲獎者的獎勵分配。
Sort:  

Very good. Have fun with this!

!-=o0o=-!

To follow curated math content follow @math-trail.
If you wish @math-trail to follow you then read this article.
Click here for Mathematics forum on chainBB

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by kenchung from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, and someguy123. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you like what we're doing please upvote this comment so we can continue to build the community account that's supporting all members.

submit again

So the competition ended, but when will the results be published?

I will do the prize presentation and announce the solution in one single post coz I dun want to create too many posts haha
So probably you have to wait for 7 days for the payout of my post, and then I will know how much is the prize pool for prize presentation

ya coz the payout time is 7 days, hope you can understand :( otherwise I have to make 4 posts for each competition: announcement, question, answer and prize presentatin

Can you just tell me the answer plz? xD

as I remember the answer should be 19, not at home though so can't check my rough work...

Coin Marketplace

STEEM 0.25
TRX 0.21
JST 0.037
BTC 98412.70
ETH 3501.42
USDT 1.00
SBD 3.41