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

4876번 - SHEET 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB9000.000%

문제

See if a spreadsheet has a consistent formulation.

Any given cell of a spreadsheet can have a formula that depends on the value from some other cell. Before trying to calculate the value of a cell it is important to determine if the definition of the formula for that cell is circular.

Our spreadsheet only has a limited formulation for expressions:

definition := cell "=" expression
expression := term | expression "+" term | expression " " term
term := factor | term "*" factor | term "/" factor
factor := number | cell | "(" expression ")"
number := digit | number digit
digit := "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
cell := "R" digit digit "C" digit digit

Valid cell rows and columns are 1 through 20, so that a total of 400 cells are available in our spreadsheet.

입력

The input file will contain one or more lines, each representing cells that are defined in the spreadsheet.

출력

Other than the standard header and trailer messages, a single line is printed for each cell defined in the input file (and in the same order). This should be the cell name followed by "circular" if evaluating the cell results in a circular definition (either directly or indirectly). If the cell can be evaluated without a circular definition, then the word "ok" should follow the cell.

제한

예제 입력 1

R01C01=1
R01C02=2
R01C03=R01C01+R01C02
R02C01=(R03C02+1)*R01C03
R03C02=R02C01

예제 출력 1

R01C01 ok
R01C02 ok
R01C03 ok
R02C01 circular
R03C02 circular

힌트

출처

ICPC > Regionals > North America > Rocky Mountain Regional > 2003 Rocky Mountain Regional Contest E번

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

출처

대학교 대회

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

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