1.24题目翻译

原题链接:Numeric Keypad_牛客题霸_牛客网

题目:

描述

The numberic keypad on your mobile phone looks like below:
123
456
789
0
suppose you are holding your mobile phone with single hand. Your thumb points at digit 1. Each time you can 1)press the digit your thumb pointing at.2)moveyour thumb right,3)move your thumb down. Moving your thumb left or up is not allowed.
By using the numeric keypad under above constrains, you can produce some numbers like 177 or 480 while producing other numbers like 590 or 52 is impossible.
Given a number K, find out the maximum number less than or equal to K that can be produced.

输入描述:

the first line contains an integer T, the number of testcases.
Each testcase occupies a single line with an integer K.

For 50%of the data ,1<=K<=999.
For 100% of the data, 1<=K<=10^500,t<=20.

输出描述:

for each testcase output one line, the maximum number less than or equal to the corresponding K that can be produced.

翻译:

你的手机上的数字键盘如下所示:123 456 789 0 假设你是用单手拿着你的手机。你的拇指指向第1位手指。每次都可以按数字 你的拇指指着你。将拇指向右移动,将拇指向下移动。不允许将拇指向左或向上移动。通过使用上述约束下的数字小键盘,您可以生成一些数字,比如 177或480,而产生其他数字,如590或52,是不可能的。给定一个数字K,找出可以产生的小于或等于K的最大数目。

第一行包含一个整数T,即测试用例的数量。每个测试箱占用包含整数K的一行。对于50%的数据,使用1<=K<=999。对于100%的数据,1<=K<=10^500,t<=20。

对于每个测试例输出一行,可以产生的小于或等于相应K的最大数字。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值