CF770B.Maximize Sum of Digits
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Anton has the integer x . He is interested what positive integer, which doesn't exceed x , has the maximum sum of digits.
Your task is to help Anton and to find the integer that interests him. If there are several such integers, determine the biggest of them.
输入格式
The first line contains the positive integer x ( 1<=x<=1018 ) — the integer which Anton has.
输出格式
Print the positive integer which doesn't exceed x and has the maximum sum of digits. If there are several such integers, print the biggest of them. Printed integer must not contain leading zeros.
输入输出样例
输入#1
100
输出#1
99
输入#2
48
输出#2
48
输入#3
521
输出#3
499