1 / 3

10563: Least Squares

10563: Least Squares. ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 1 0563 : Least Squares 解題者: 陳柏 琿 解題日期: 20 14 年 4 月 1 日

dex
Download Presentation

10563: Least Squares

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. 10563: Least Squares • ★★★☆☆ • 題組:Problem Set Archive with Online Judge • 題號:10563: Least Squares • 解題者:陳柏琿 • 解題日期:2014年4月1日 • 題意:給一個矩陣大小m(<=100)和n(<=80)以及不規則的圖形 (‘?’表圖形部分而 ‘.’表示非圖形之空白區),然後用各種大小的正方形完整地覆蓋它(‘?’),以蠟筆著色的方式,顏色以A~Z表示並且相鄰兩正方形不得同色,需要注意的是,題目要的不是以最少的正方形去覆蓋,而是要用字典排序最小的方式去覆蓋。

  2. 題意範例: m=5 n=5           ?????            .???. .???.            .???.            ?????    ABBBA      ABAAB    .BBB.      .CAA.    .BBB.      .ABB.    .AAC.      .CBB.    BAABC      ABACA 題目不是要最少的正方形覆蓋,而是要以最小字典排序去覆蓋。

  3. 解法:預設為A若有相鄰的與原色相同就+1變成B,直到無相鄰同色,再看下一個字元的排序最小可能值,若沒有比原位置的字元小,則開始擴張領土,以護城河的方式擴張,每加一層,就要判斷一次顏色的重複以及是否有問號,直到碰到不符合者跳出迴圈,繼續尋找未著色區域到圖形最後結束。解法:預設為A若有相鄰的與原色相同就+1變成B,直到無相鄰同色,再看下一個字元的排序最小可能值,若沒有比原位置的字元小,則開始擴張領土,以護城河的方式擴張,每加一層,就要判斷一次顏色的重複以及是否有問號,直到碰到不符合者跳出迴圈,繼續尋找未著色區域到圖形最後結束。 • 解法範例:無 • 討論:無

More Related