1 / 3

11412: Dig the Holes

11412: Dig the Holes. ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 11412: Dig the Holes 解題者: 鄭凱原 解題日期: 200 8 年 9 月 2 日 題意: 猜數字遊戲英文版。答案由 10 個數字挑 4 個數字改為 6 個英文字挑 4 個字, Mr.Fruit 想知道兩次答案的回傳有沒有矛盾的地方。

umay
Download Presentation

11412: Dig the Holes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 11412: Dig the Holes • ★★☆☆☆ • 題組:Problem Set Archive with Online Judge • 題號:11412: Dig the Holes • 解題者:鄭凱原 • 解題日期:2008年9月2日 • 題意:猜數字遊戲英文版。答案由10個數字挑4個數字改為6個英文字挑4個字,Mr.Fruit 想知道兩次答案的回傳有沒有矛盾的地方。 測資第一個數字表示接下來有幾組測資,每組測資會有兩行,每行會有四個英文字和2個數字,英文表示Mr.Fruit猜測的答案,第一個數字表示猜測的答案中,有幾個字是正確答案之一且在正確位置的,第二個是數字表示有幾個字是正確答案之一但不在正確位置的。

  2. 題意範例: Sample Input 7 VRBG 2 2 // 第二行4 0表示正確答案即為RVGO RVGO 4 0 // 由此帶入第一行的答案 後面數字應該是0 3 因此這組測資的答案為Cheat YGOR 4 0 RGOB 4 0 RBVY 2 1 ORVY 4 0 Sample Output Cheat Cheat Possible

  3. 解法:暴力法 因為只有6個英文,所以答案只有720組(6!),因此,只需要把所有的答案跟兩筆測資作比對,若有任何一組答案符合測資的數字,代表Possible,否則,即為Cheat。 • 解法範例:無 • 討論: 時間複雜度:6!/2 = 360 720組答案中,有一半是重複的,可忽略不計。

More Related