-
Notifications
You must be signed in to change notification settings - Fork 0
/
cf_1355_a.py
63 lines (56 loc) · 1.37 KB
/
cf_1355_a.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
for i in range(int(input())):
a,k = list(map(int,input().split()))
if k>1:
for j in range(0,k-1):
digit = []
t = a
m = t % 10
min = t%10
while(t!=0):
# digit.append(t%10)
if m<t%10:
m = t%10
elif min>t%10 and m>0:
min = t % 10
t=t//10
if min == 0:
break
a += (m*min)
print(a)
#
# for i in range(int(input())):
# a, k = list(map(int, input().split()))
# if k > 1:
# for j in range(0, k - 1):
# digit = []
# t = a
# while (t != 0):
# digit.append(t % 10)
# t = t // 10
# m = max(digit)
# mi = min(digit)
# a += (m * mi)
# print(a)
# for t in range(k):
# alen = len(str(a))
# ns = []
# r = 0
# a = str(a)
# for j in range(1, alen):
# ns.append(int(a[j - 1]))
#
# if len(ns)>0:
# ma = max(ns)
# mi = min(ns)
# a=int(a)+(ma*mi)
#
# print(a)
# a = input()
# alen = len(a)
# ns = []
# for j in range(1,alen):
# ns.append(int(a[j-1]))
#
# ma = max(ns)
# mi = min(ns)
# print(ma, mi)