P5283: 中心对称数
传统题
1.000s
时间限制
128MB
内存限制
131 提交
35 解决
【题目描述】
题目背景
小爱在超市购物时,发现商品的价格标签被放反了,但有一些标签倒置后,数字竟然是不变的。我们称转置 180 度后不变的十进制数字为中心对称数(Strobogrammatic Numbers)。下图分别给出 0 到 9 这十个数字倒置后的样子:
题目描述
中心对称数是指沿中心旋转 180 度后不变的十进制数字。
0
,1
,8
这三个数字旋转 180 度后与原数字一致;
6
旋转后得 9
;
9
旋转后得 6
;
其他数字旋转后不构成合理的数字。
给定一个自然数 n
,请判断 n 是否是中心对称数,如果是,输出 Strobogrammatic number
,如果不是,输出 Not a strobogrammatic number
。
中心对称数的例子有 101,18081
,69
等,但注意666 不是,因为它倒转后得到的是 999。
输入格式
单个正整数:表示 n。
输出格式
如果输入的数字是中心对称数,输出 Strobogrammatic number
;
如果不是,输出 Not a strobogrammatic number
。
数据范围
记 n
的十进制表示长度为 |n|
,
对于50% 的数据,1≤|n|≤10
;
对于 100% 的数据,1≤|n|≤1000
。
样例数据
输入:
18081
输出:
Strobogrammatic number
输入:
666
输出:
Not a strobogrammatic number
输入:
4287
输出:
Not a strobogrammatic number