Codeforces Round 291 (Div. 2)
翻译中…
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.
翻译中…
Input
翻译中…
The first line contains a single integer $*x*$ $(1 ≤ *x* ≤ 10^{18})$ — the number that Luke Skywalker gave to Chewbacca.
翻译中…
Output
翻译中…
Print the minimum possible positive number that Chewbacca can obtain after inverting some digits. The number shouldn't contain leading zeroes.
翻译中…
样例
Input #1
27
Output #1
22
InputCopy
OutputCopy
Input #2
4545
Output #2
4444
InputCopy
OutputCopy
题目信息
标签
贪心
模拟
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。