#P7662. [COCI 2014/2015 #5] ZGODAN

    ID: 8566 远端评测题 1000ms 32MiB 尝试: 0 已通过: 0 显示难度普及+/提高− 上传者: 标签>2014COCI(克罗地亚)

[COCI 2014/2015 #5] ZGODAN

Problem Description

Define a Handsome number: in this positive integer, the parity of any two adjacent digits is different.

Given a positive integer nn, find the Handsome number closest to nn. If there are multiple answers, output them in increasing order.

Input Format

A positive integer nn.

Output Format

The Handsome number(s) closest to nn.

13
12 14
5801001
5810101

Hint

For 100%100\% of the testdata, 1n1010001 \leq n \leq 10^{1000}.

Translated from COCI 2014/2015 CONTEST #5.

Translated by ChatGPT 5