305647: CF1070A. Find a Number
Memory Limit:256 MB
Time Limit:3 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Find a Number
题意翻译
给定两个数$d(1\le d \le 500)$和$s(1\le s\le 5000)$,找出最小数$n$使得$d\mid n$且$n$的各个位数之和为$s$。题目描述
You are given two positive integers $ d $ and $ s $ . Find minimal positive integer $ n $ which is divisible by $ d $ and has sum of digits equal to $ s $ .输入输出格式
输入格式
The first line contains two positive integers $ d $ and $ s $ ( $ 1 \le d \le 500, 1 \le s \le 5000 $ ) separated by space.
输出格式
Print the required number or -1 if it doesn't exist.
输入输出样例
输入样例 #1
13 50
输出样例 #1
699998
输入样例 #2
61 2
输出样例 #2
1000000000000000000000000000001
输入样例 #3
15 50
输出样例 #3
-1