#abc321a. A - 321-like Checker

A - 321-like Checker

Score : 100100 points

问题描述

一个正整数 xx 如果满足以下条件,则被称为321-like Number

  • xx 的各位数字从高位到低位严格递减。
  • 换句话说,若 xx 具有 dd 位数字,则对于所有满足 1i<d1 \le i < d 的整数 ii,它应满足:
    • xx 的第 ii 位数字)>>xx 的第 (i+1)(i+1) 位数字)。

注意,所有一位的正整数都是 321-like Numbers。

例如,321321964109641011 都是 321-like Numbers,但 123123210921098641186411 不是。

给定输入 NN,如果 NN 是一个 321-like Number,则输出 Yes,否则输出 No

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

A positive integer xx is called a 321-like Number when it satisfies the following condition.

  • The digits of xx are strictly decreasing from top to bottom.
  • In other words, if xx has dd digits, it satisfies the following for every integer ii such that 1i<d1 \le i < d:
    • (the ii-th digit from the top of xx) >> (the (i+1)(i+1)-th digit from the top of xx).

Note that all one-digit positive integers are 321-like Numbers.

For example, 321321, 9641096410, and 11 are 321-like Numbers, but 123123, 21092109, and 8641186411 are not.

You are given NN as input. Print Yes if NN is a 321-like Number, and No otherwise.

Constraints

  • All input values are integers.
  • 1N999991 \le N \le 99999

Input

The input is given from Standard Input in the following format:

NN

Output

Print Yes if NN is a 321-like Number, and No otherwise.

Sample Input 1

321

Sample Output 1

Yes

For N=321N=321, the following holds:

  • The first digit from the top, 33, is greater than the second digit from the top, 22.
  • The second digit from the top, 22, is greater than the third digit from the top, 11.

Thus, 321321 is a 321-like Number.

Sample Input 2

123

Sample Output 2

No

For N=123N=123, the following holds:

  • The first digit from the top, 11, is not greater than the second digit from the top, 22.

Thus, 123123 is not a 321-like Number.

Sample Input 3

1

Sample Output 3

Yes

Sample Input 4

86411

Sample Output 4

No

update @ 2024/3/10 01:39:50