問題一覧 > 通常問題

No.1624 Reflection in a Triangle

レベル : / AI推定難易度 : 1850 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 80
作問者 : null / テスター : otera sak
お気に入りにしたユーザー ProblemId : 5353 / 自分の提出
問題文最終更新日: 2022-04-25 23:40:48
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 306 (順位表) の他の問題:

Problem Statement

null's house is on the $xy$ plane and is the right isosceles triangle $ABC$ with $A=(0, 0), B=(1, 0), C=(0, 1)$, entirely covered with mirrors. A light is placed at vertex $A$.

The light emits a laser. The laser is fired from point $A$ in a direction where $x, y$ are both positive, with slope $a$ ($\tan \theta = a$, where $\theta$ is the angle from the $x$-axis). When the laser hits a side, it reflects so that the angle of incidence equals the angle of reflection, and it stops when it hits any of the points $A, B, C$.

Output the vertex that the laser hits next after being fired from point $A$, and the number of sides it reflects off before hitting that vertex. If the laser does not hit any of the points $A, B, C$ within a finite number of reflections, output -1.

Constraints

  • $0.001 \le a \le 1000.000 = 10^3$
  • The input has exactly $3$ digits in its fractional part.
  • Input

    $a$
    

    Output

    Output the vertex that the laser hits next after being fired from point $A$, and the number of sides it reflects off before hitting that vertex, separated by a space. If the laser does not hit any of the points $A, B, C$ within a finite number of reflections, output -1. Print a newline at the end.

    Sample

    Sample 1
    Input
    1.000
    
    Output
    A 1
    

    It reflects $1$ time off $AB$ and comes straight back.

    Sample 2
    Input
    0.500
    
    Output
    C 2
    

    Sample 3
    Input
    0.124
    
    Output
    C 528
    

    提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。