BaseB
KHOA CÔNG NGHỆ THÔNG TIN Vòng YoYo 8
Huế, Ngày 18 tháng 11 năm 2016 BaseB
Theo truyền thống số được viết trong cơ sở 10 ( "thập phân"). Đó là, mỗi chữ số là một số
từ 0 đến 9. Chúng tôi nghĩ ra một số như là đại diện thập phân của nó. Tuy nhiên, như bạn có thể
biết, con số có thể được viết trong cơ sở b cho bất kỳ b> 0. Trong trường hợp này, mỗi chữ số là một số
giữa 0 và b-1. Ví dụ trong cơ sở 4, chúng tôi có thể viết 3312 hoặc 30.
Giá trị của một số văn bản trong cơ sở b được xác định như sau: Giả sử số lượng nhất định
trong cơ sở b là d
n-1
... d
0
, nơi mỗi d
nằm giữa 0 và b-1. Điều này thể hiện số lượng:
d
0
+ d
1
* b + d
2
* b
2
+ ... + d
i
* b
i
i
+ ... + d
n-1
* b
n-1
Chúng tôi không cho phép nhập số 0 đầu của trong các đại diện. Ví dụ, chúng ta không thể viết 003.312 hoặc
03.312 thay vì 3312.
Cho một số trong một số thập phân có thể tính các đại diện cơ sở b bằng cách đảo ngược trên
tính toán.
Nó rất dễ dàng để kiểm tra các cơ sở 4 đại diện 3312 là số thập phân 246 và
các cơ sở 4 đại diện 30 biểu thị 12. Tương tự như vậy, các cơ sở đại diện 12 2 11 10 (mà
chúng ta sử dụng khoảng trống để tách các chữ số) biểu thị số thập phân 430 trong khi các cơ sở
12 đại diện 3 0 2 là số 434.
nhiệm vụ:
Bạn sẽ nhận được b và các đại diện cơ sở b của hai số A và B. nhiệm vụ của bạn là để
in ra các đại diện cơ sở b của sản phẩm A × b.
Ví dụ các sản phẩm của các cơ sở 4 số 3312 và 30 văn bản trong cơ sở 4 là 232020.
Tương tự như vậy, các sản phẩm của các cơ sở 12 số 2 11 10 3 0 2 văn bản trong cơ sở 12 8 11 11
11 8.
Dữ liệu vào:
dòng đầu tiên của input chứa 3 số nguyên b, N và M, trong đó b là cơ sở. N và M là
số các chữ số trong các đại diện (trong cơ sở b) của hai số cho trước. Thứ hai
dòng chứa N số nguyên không gian tách D
cho các đại diện cơ sở b
của số đầu tiên và dòng thứ ba chứa M không gian tách nguyên tử
N-1
cho các đại diện cơ sở b của số thứ hai.
Dữ liệu ra:
D
N-2
... D
0
Dòng đầu tiên của đầu ra phải là một số nguyên L đơn biểu thị độ dài của các cơ sở
đại diện b của sản phẩm. Dòng thứ hai chứa L không gian tách biệt các số nguyên
cho các đại diện cơ sở b của sản phẩm.
Các example:
Trang 1 của 2
M-1
, E
M-2
... E
0
KHOA CÔNG NGHỆ THÔNG TIN Vòng YoYo 8
Huế, Ngày 18 tháng 11 năm 2016 BaseB
data vào: Dữ liệu ra:
4 4 2
3 3 1 2
3 0
6
2 3 2 0 2 0
Dữ liệu vào: Dữ liệu ra:
12 3 3
2 11 10
3 0 2
Ràng buộc:
Giá trị: 1 ≤ N, M ≤ 1000.
Thời hạn: 1000 ms.
Giới hạn bộ nhớ: 32 MB.
Trang 2 của 2
5
8 11 11 11 8
đang được dịch, vui lòng đợi..