#abc321a. A - 321-like Checker
A - 321-like Checker
Score : points
问题描述
一个正整数 如果满足以下条件,则被称为321-like Number。
- 的各位数字从高位到低位严格递减。
- 换句话说,若 具有 位数字,则对于所有满足 的整数 ,它应满足:
- ( 的第 位数字) ( 的第 位数字)。
注意,所有一位的正整数都是 321-like Numbers。
例如,、 和 都是 321-like Numbers,但 、 和 不是。
给定输入 ,如果 是一个 321-like Number,则输出 Yes
,否则输出 No
。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
A positive integer is called a 321-like Number when it satisfies the following condition.
- The digits of are strictly decreasing from top to bottom.
- In other words, if has digits, it satisfies the following for every integer such that :
- (the -th digit from the top of ) (the -th digit from the top of ).
Note that all one-digit positive integers are 321-like Numbers.
For example, , , and are 321-like Numbers, but , , and are not.
You are given as input. Print Yes
if is a 321-like Number, and No
otherwise.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print Yes
if is a 321-like Number, and No
otherwise.
Sample Input 1
321
Sample Output 1
Yes
For , the following holds:
- The first digit from the top, , is greater than the second digit from the top, .
- The second digit from the top, , is greater than the third digit from the top, .
Thus, is a 321-like Number.
Sample Input 2
123
Sample Output 2
No
For , the following holds:
- The first digit from the top, , is not greater than the second digit from the top, .
Thus, 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