CF514A.Chewbaсca and Number
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca to transform the initial number x to the minimum possible positive number by inverting some (possibly, zero) digits. The decimal representation of the final number shouldn't start with a zero.
卢克·天行者给了丘巴卡一个整数 x。丘巴卡不擅长处理数字,但他喜欢对数字中的各位进行“翻转”操作。“翻转”数字 t 指的是将其替换为数字 9−t。
请帮助丘巴卡通过翻转其中某些(可能为零个)数字,将初始数字 x 变换为最小的正整数。最终数字的十进制表示不能以 0 开头。
输入格式
The first line contains a single integer x (1 ≤ x ≤ 1018) — the number that Luke Skywalker gave to Chewbacca.
第一行包含一个整数 x(1 ≤ x ≤ 1018)——这是卢克·天行者给丘巴卡的数字。
输出格式
Print the minimum possible positive number that Chewbacca can obtain after inverting some digits. The number shouldn't contain leading zeroes.
输出楚巴卡在翻转某些数位后所能得到的最小可能的正整数。该数不能包含前导零。
输入输出样例
输入#1
27
输出#1
22
输入#2
4545
输出#2
4444
输入解题思路,AI测评打分。不知道怎么写?