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

24924번 - Card Divisibility 다국어

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

문제

Since you have learned Modular Arithmetic, you know how to work with quotients and remainders. For every pair of integers $a$ and $m$ with $m>0,ドル there exist unique integers $q$ and $r$ such that $a=m⋅q+r$ and 0ドル≤r<m$. But this is a bit simple, you wonder if you can do something more interesting with this theory.

Right now, you are holding a handful of consecutive cards numbered from $L$ to $R$. You lay the cards out side-by-side to create a single large number (i.e. concatenating the digits of your cards). You would like to know the remainder (which is the $r$ in $a=m⋅q+r$) when this number is divided by 9ドル$. For example, $L=9$ and $R=11$ means you are holding cards 9,10,11ドル$. Concatenating these numbers produces the number 91011ドル$. The remainder $r$ left upon dividing this number by 9ドル$ would be $r=3$.

입력

Input consists of a single line containing two integers $L$ (1ドル≤L≤10^{12}$) and $R$ ($L≤R≤10^{12}$). This means you are holding the cards with numbers from $L$ to $R,ドル inclusive.

출력

Display a single line containing the remainder of the concatenated number if you were to divide it by 9ドル$.

제한

예제 입력 1

2 5

예제 출력 1

5

예제 입력 2

3 10

예제 출력 2

7

예제 입력 3

3 100

예제 출력 3

7

예제 입력 4

1000000000 1000000007

예제 출력 4

0

예제 입력 5

9 11

예제 출력 5

3

힌트

출처

University > University of Alberta Programming Contest > UAPC 2022 > Division 2 B번

  • 문제를 만든 사람: Jiacheng Wu
(追記) (追記ここまで)

출처

대학교 대회

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

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