Xiao Ming's climbing record

TimeLimit:1000MS  MemoryLimit:128MB
64-bit integer IO format:%lld
未提交 | 登录后收藏
Problem Description

When Xiaoming arrived at the last island, he came to the mountain interesting.There are many roads in front of Xiaoming. He can choice one road to climb, each road have different uphill and downhill slopes. Each choice of road represents a series of number. such as 12321 road. If Xiao Ming chooses this road. He will climb the mountain at a height of 1->2->3->2-1. And Xiao Ming will gets a sense of pleasure if he climbs his choice. This pleasure is The product of each digit in his choice. If Xiaoming choice the road 12321, we can multiply the number 1*2*3*2*1 = 12. So Xiaoming’s pleasure is 12. Because some road cannot be passed in the mountain.So Xiaoming arrived Mountain Interesting and only can choose the road  is serial number l to r. Xiaoming also has a special habit that the height of mountain must non-decreasing first and non-increasing later.What's more,continuous same height cannot exceed k and the highest point is unique.(Highest point can't be the last.)Can you figure out how much

pleasure XiaoMing can get most?

让你计算l~r之间的数满足某种条件的累积最大值

条件:将这个数每一位数从最高位到最低位拆成以下形式

image.png

然后这些数要满足存在一个image.png使得:

image.png

最长的连续相等的a不能超过k个


Input

The first line contains a number T indicates T group test (T<=1e4)

For each group

test data consists of three numbers l, r, k (1<=l<=r<=1e18,1<=k<=20).


Output

Output the maximum pleasure that Xiao Ming can get, output 0 if not available


SampleInput
2
22322 22322 1
12321 12321 2
SampleOutput
0
12
Submit
题目统计信息详细
总AC数5
通过人数3
尝试人数3
总提交量20
AC率15.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: