Logo
(追記) (追記ここまで)

25949번 - Jar Game 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB44822918753.276%

문제

Two players F(irst) and S(econd) play a game with three jars each containing $a,ドル $b$ and $c$ pebbles. The game is played according to the following rules:

  • Two players take turns one at a time. For each turn, the player chooses a jar and takes some pebbles from the jar.
  • F starts first, then S next. These turns alternate till the game ends.
  • The number of pebbles that can be drawn at the $k$-th turn is $k$; the number of pebbles taken by F at the first turn is 1ドル$. So in the next turn, S takes 2ドル$ pebbles, then at the third turn, F takes 3ドル$ pebbles, and so on.
  • For each turn, the pebbles must be taken out of only one jar.
  • At the $k$-th turn, if the number of pebbles remaining in the chosen jar is less than $k,ドル the player should take all the remained pebbles in that jar. If the remained pebbles is greater than $k$ in the chosen jar, then the player is not allowed to take less than $k$ pebbles from the jar.
  • If there are no pebbles left in the three jars, then the game is over. The player with more pebbles wins the game when the game is over. So in some cases, a draw may be possible if the number of pebbles two players took is the same.
  • We assume that two players F and S do their best to win.
  • Two players always know the exact number of the pebbles remained in three jars. There is no hidden information in this jar game.

Given the number of pebbles in three jars, write a program to find who is the winner or if the draw is possible.

입력

Your program is to read from standard input. The input starts with a line containing three integers, $a,ドル $b$ and $c$ (1ドル ≤ a, b, c ≤ 100$) denoting the number of pebbles in three jars at the beginning.

출력

Your program is to write to standard output. Print exactly one line. The line should contain a capital letter among {F, S, D}. {F, S} means the winner among two players and D denotes a draw when the game ends.

제한

예제 입력 1

2 5 3

예제 출력 1

F

예제 입력 2

4 1 5

예제 출력 2

D

예제 입력 3

5 3 5

예제 출력 3

S

힌트

출처

ICPC > Regionals > Asia Pacific > Korea > Nationwide Internet Competition > Seoul Nationalwide Internet Competition 2022 G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /