Write a program that reads numbers from the input and prints them after having added 1 to their even digits.
For instance, the program will transform number
785902 into
795913.
The input has many cases. Each case is a natural number in one line.
For each case, the output is a separate line with the number with its even digits incremented by 1.
Massive storage solutions are not accepted (like
strings or vectors).
Read numbers from the input into variables of type
int, for example with
cin a,
and solve the problem operating with integers using
+, -, ,
/, and %.
Evaluation over 10 points:
Slow solution: 5 points.
Fast solution: 10 points.
We understand as fast solution one which is correct, has linear cost and passes the public and private tests. We understand as slow solution one which is not fast, but it is correct and passes the public tests.
Author: PRO1
Generation: 2026-01-25T13:51:37.619Z
© Jutge.org, 2006–2026.
https://jutge.org