QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22321. 哦,這些滾輪

Statistics

Farmer John 安裝了一台新絞盤,使他把乾草捆吊進牛棚時更省力。它由 Rube Goldberg Winch Company 製造,滾輪多得令人摸不著頭腦。絞盤有一塊巨大鋼板,上面裝著許多滾輪;動力最終來自主動滾輪,FJ 將其位置記為原點 $(0,0)$。它帶動另一個滾輪,後者又帶動下一個,如此繼續直到末端滾輪。FJ 正在尋找末端滾輪,想知道究竟是哪一個。

download.php?type=attachments&id=2917&r=0

FJ 記錄了每個滾輪的座標 $x_{i}$、$y_{i}$ $(-5,000 \le x_{i} \le 5,000; -5,000 \le y_{i} \le 5,000)$ 和半徑 $r_{i}$ $(3 \le r_{i} \le 1024)$,共有 $N$ $(2 \le N \le 1080)$ 個滾輪。告訴他傳動鏈末端滾輪的 $x,y$ 座標(它被帶動,卻不帶動其他滾輪)。除主動滾輪外,每個滾輪恰好由另一個滾輪帶動。

輸入格式

  • 第 1 行:單個整數 $N$。
  • 第 $2,\ldots,N+1$ 行:第 $i+1$ 行用三個空格分隔的整數 $x_{i}$、$y_{i}$ 和 $r_{i}$ 描述滾輪 $i$。

輸出格式

  • 第 1 行:一行兩個空格分隔的整數,分別為傳動鏈末端滾輪的 $x,y$ 座標。

範例

輸入格式 1

3
0 0 30
30 40 20
-15 100 55

輸出格式 1

-15 100

說明

共有三個滾輪。第一個在原點,半徑 30;它帶動位於 $(30,40)$、半徑 20 的滾輪;後者又帶動位於 $(-15,100)$、半徑 55 的第三個滾輪。

題目作者:Rob Kolstad,2008

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.