RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00531

Trol

Unrated 레이팅 미적용
난이도
1s
시간 제한
512MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Stjepan recently received his bachelor’s degree in mathematics from the University
of Zagreb. Naturally, his parents are very proud and have decided to give him
all positive integers not greater than \(2^{60}\) as a gift. To keep them safe, he quickly
stored all of those numbers in an array \(A\), such that \(A\)\(i = i\).
His jealous friend Marin decided to prank him by repeatedly replacing each
element of \(A\) with the sum of its digits until all elements of \(A\) consisted of a
single digit. For example, the initial value of \(197^{th}\) element of \(A\) was 197. Marin
first changed that value to \(1 + 9 + 7 = 17\) and then changed its value again to
\(1 + 7 = 8\).
Stjepan is devastated and begs Marin to return his array to its initial state.
Unfortunately, Marin won’t do that until Stjepan correctly answers his \(Q\) queries:
“What is the sum of numbers from \(l-th\) to \(r-th\) element of \(A\)?”.
Help Stjepan answer those queries!

제약

In test cases worth a total of 10 points, for each query will hold \(1 \le l@@RISE_MATH_BLOCK_0@@i \le 9\).
In test cases worth a total of 30 points, for each query will hold \(r@@RISE_MATH_BLOCK_1@@i \le 1000\).

입력 형식

The first line contains an integer \(Q\) (\(1 \le Q \le 100\)) from the task description.
The next \(Q\) lines contain two integers \(l@@RISE_MATH_BLOCK_0@@i\) (\(1 \le l@@RISE_MATH_BLOCK_1@@i \le 2^{60}\)), the parameters of Marin’s \(i-th\) query.

출력 형식

Output the answers to each of Marin’s \(Q\) queries. Each answer should be printed in a separate line and
their order should match the order of the queries as they are given in the input.

예제 1
입력
1
1 5
출력
15
예제 2
입력
2
9 13
44 45
출력
19
17
예제 3
입력
1
1998 2018
출력
102
설명

Clarification of the second example:
1st query →A9 = 9, A10 = 1 + 0 = 1, A11 = 1 + 1 = 2, A12 = 1 + 2 = 3, A13 = 1 + 3 = 4.
A9 + A10 + A11 + A12 + A13 = 9 + 1 + 2 + 3 + 4 = 19.
2nd query →A44 = 4 + 4 = 8, A45 = 4 + 5 = 9. A44 + A45 = 8 + 9 = 17.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2019/2020 Contest 1

평가 및 의견

Trol

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Trol

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8