QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 2048 MB

#24218. 濃縮瑪奇朵

Statistiques

Tommy 喜歡兩樣東西:都市計畫和濃縮瑪奇朵(espresso macchiato)。他的日程排得滿滿當當,沒日沒夜地工作,幾乎沒有一分鐘能停下來閒聊——但人總有自己的輕重緩急,咖啡對他來說至關重要。因此,當他接手規劃一座全新城市的工作時,他看到了機會:確保自己每天早上上班途中都能毫無壓力地喝到恰好一杯瑪奇朵。

這座城市是一個 $n \times n$ 的網格。Tommy 的家位於左上角,工作地點位於右下角。他總是行色匆匆,因此在從家步行去上班的路上,他每次只會向右或向下移動。

他希望設計的城市同時滿足以下兩個條件:

  • 網格中的每個格子要麼沒有咖啡店,要麼恰好有一家咖啡店。Tommy 的家和工作地點所在的格子不能有咖啡店。

  • 無論 Tommy 在網格中如何行走,他的路徑都會經過恰好一個有咖啡店的格子。

每天早上一杯瑪奇朵——絕不能沒有,因為他需要咖啡;也絕不能是兩杯,因為誰有那個時間呢?請幫他設計一座符合其限制條件的城市!

輸入格式

輸入的第一行包含一個整數 $t$ $(1 \le t \le 49)$,表示測試資料的組數。

接下來是 $t$ 組測試資料的描述。每組測試資料僅一行,包含一個整數 $n$ $(2 \le n \le 50)$,表示 Tommy 正在規劃的城市大小。

輸出格式

對於每組測試資料,輸出一個 $n \times n$ 的網格。每個字元要麼是表示沒有咖啡店的格子的 .,要麼是表示有咖啡店的格子的 C。

如果存在多種合法的都市計畫方案,輸出任意一種皆可。可以證明,總是能夠構造出合法的都市計畫方案。

範例

輸入格式 1

2
6
7

輸出格式 1

.....C
....C.
...C..
..C...
.C....
C.....
.......
.......
.......
.......
......C
.....C.
....C..

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.