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

22244번 - Cataloguing numbers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB155716446.377%

문제

Whenever a new book arrives to the library of the Aglargond School of Magic, it gets a unique number, defined as follows:

  • First 7 digits represent the publishing date of the book: first 2 for day, next 2 for month and final 3 for year. Magicians use the same date system we use, including the rules regarding leap years (February has 28 days, unless the year is leap, when it has 29 days). If the three digit number for year is in the interval [000, 599] it represents one of the years [2000, 2599], otherwise it is from the interval [1600, 1999].
  • Next digit describes author of the book: 1 if the author is a member of Aglargond School of Magic, 6 if the author is a member of other School of Magic and 9 otherwise.
  • Final, 9th digit is the control digit, and it represents remainder after division by 7 of the sum of squares of the first 8 digits.

Write a program that determines for 3 given number if they are correct cataloguing numbers.

입력

The input contains 3 lines. Each line contains one 9 digit number.

출력

The output has exactly 3 lines. In each line write only a single number 0 or 1, where 1 means that corresponding number from the input is correct, and 0 means that it is not correct.

제한

예제 입력 1

310456316
290260060
310053435

예제 출력 1

0
1
0

힌트

A year is a leap year if it is divisible by 4, unless it is divisible by 100 but not by 400 (for example leap years are 2000 and 2004, but not 2002 nor 1900).

출처

Olympiad > Balkan Olympiad in Informatics > Junior Balkan Olympiad in Informatics > JBOI 2007 3번

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

출처

대학교 대회

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

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