Nộp bài | Các bài nộp | Làm tốt nhất | Về danh sách bài |
NDIGIT - The Nth digit |
English | Vietnamese |
The number A(K) is defined by writing the numbers 1^K, 2^K, 3^K, ... sucessively in a right to left order.
For example, A(1) = ...181716151413121110987654321.
A(2)= ...169144121100816449362516941.
Consider the sum S = A(1) + A(2). The end of S is: ...350860272513937560350171262.
Given N, K1, K2. Your task is to find the N-th digit from the right of S = A(K1) + A(K2)(the rightmost digit of S is counted as the first digit).
Input
There are 3 sub test cases. Each test case is written in a line containing 3 integers N, K1, K2 (1 ≤ K1, K2 ≤ 5. 1 ≤ N ≤ 1,000,000,000)
Output
Print out 3 corresponding answers to the sub test cases.
Grading
In each test case, you will get 5 marks for 3/3 correct answers, 3 marks for 2/3 correct answers, 1 marks for 1 correct answer, and 0 otherwise.
Example
Input 1 1 2 3 1 2 5 1 2 Output 2 2 7
Được gửi lên bởi: | Lê Đôn Khuê |
Ngày: | 2008-06-27 |
Thời gian chạy: | 1.639s |
Giới hạn mã nguồn: | 10000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Ngôn ngữ cho phép: | ADA95 ASM32 BASH BF C CSHARP CPP C99 CLPS LISP sbcl LISP clisp D FORTRAN HASK ICON ICK JAVA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST TEXT WHITESPACE |
Nguồn bài: | VNOI Marathon '08 - Round 3/DivA Problem Setter: Lê Đôn Khuê |