-
Notifications
You must be signed in to change notification settings - Fork 1
/
A. Adding Digits.py
84 lines (71 loc) · 2.3 KB
/
A. Adding Digits.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import sys
from functools import reduce
from collections import Counter
import time
import datetime
from math import sqrt,gcd
# def time_t():
# print("Current date and time: " , datetime.datetime.now())
# print("Current year: ", datetime.date.today().strftime("%Y"))
# print("Month of year: ", datetime.date.today().strftime("%B"))
# print("Week number of the year: ", datetime.date.today().strftime("%W"))
# print("Weekday of the week: ", datetime.date.today().strftime("%w"))
# print("Day of year: ", datetime.date.today().strftime("%j"))
# print("Day of the month : ", datetime.date.today().strftime("%d"))
# print("Day of week: ", datetime.date.today().strftime("%A"))
def ip(): return int(sys.stdin.readline())
def sip(): return sys.stdin.readline()
def mip(): return map(int,sys.stdin.readline().split())
def mips(): return map(str,sys.stdin.readline().split())
def lip(): return list(map(int,sys.stdin.readline().split()))
def matip(n,m):
lst=[]
for i in range(n):
arr = lip()
lst.append(arr)
return lst
def factors(n): # find the factors of a number
return list(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def minJumps(arr, n): #to reach from 0 to n-1 in the array in minimum steps
jumps = [0 for i in range(n)]
if (n == 0) or (arr[0] == 0):
return float('inf')
jumps[0] = 0
for i in range(1, n):
jumps[i] = float('inf')
for j in range(i):
if (i <= j + arr[j]) and (jumps[j] != float('inf')):
jumps[i] = min(jumps[i], jumps[j] + 1)
break
return jumps[n-1]
def dic(arr): # converting list into dict of count
return Counter(arr)
def check_prime(n):
if n<2:
return False
for i in range(2,int(n**(0.5))+1,2):
if n%i==0:
return False
return True
# --------------------------------------------------------- #
# sys.stdin = open('input.txt','r')
# sys.stdout = open('output.txt','w')
# --------------------------------------------------------- #
a,b,n = mip()
flag = 0
for i in range(0,10):
p = a*10
p += i
if p%b==0:
a = p
flag = 0
break
else:
flag = 1
if flag==1:
print(-1)
else:
a = str(a)
for i in range(n-1):
a+='0'
print(a)