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

26198번 - Chronogram 다국어

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

문제

A chronogram is an inscription (usually found on monuments) in which the year of the event commemorated by the monument is encoded. The year is obtained by adding up all the values of those letters that can appear in Roman numerals. Values of individual letters:

  • I … 1
  • V … 5
  • X … 10
  • L … 50
  • C … 100
  • D … 500
  • M … 1000

Chronograms are usually studied by theologians. As a part of a study of great importance in the Central Europe, they compiled a long list of chronograms. The monks would like to make sure they do not make any mistake in calculating the corresponding years and therefore decided to use a computer program. Since monks are not skilled programmers, they urgently need your help.

Write a program that will extract the year of the event from a chronogram.

입력

The first line of the input contains an integer $T,ドル i.e. the number of test cases. This is followed by $T$ lines; each line contains one chronogram that contains at most 1000 characters. The text contains only uppercase letters of the English alphabet and spaces.

출력

For each chronogram output one integer, i.e. the year encoded in the chronogram.

제한

  • 1ドル \leq T \leq 10000$
  • Every line contains at most 1000 characters.
  • A character may be an uppercase letter of the English alphabet or a space.
  • 예제 입력 1

    2
    VIDE ISTA ECCLESIA CATHEDRALIS SVB PRAESVLE FRANCISCO PAROCHOQVE STANSLAO LAETA EXSISTIT REVIVISCENS
    ENTERTAINING REGIONAL CONTEST HELD IN EXTRAVAGANT LJUBLJANA WITH RIDICULOUSLY HARD TASKS
    

    예제 출력 1

    1999
    2022
    

    힌트

    출처

    ICPC > Regionals > Europe > Central European Regional Contest > CERC 2022 연습 세션 X번

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

    출처

    대학교 대회

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

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