当前位置:网站首页>< Sicily> 1000. number reversal
< Sicily> 1000. number reversal
2022-06-23 12:41:00 【Mengfei】
The original question is as follows
1000. Number reversal Time Limit: 1sec Memory Limit:256MB
Description
Given an integer , Please reverse the number in each digit to get a new number . New numbers should also satisfy the common form of integers , That is, unless the given original number is zero , Otherwise, the highest digit of the new number after inversion should not be zero ( See example 2).
Input
Input common 1 That's ok , An integer N. -1,000,000,000 ≤ N≤ 1,000,000,000.
Output
The output, 1 That's ok , An integer , Represents the new number after inversion .
Sample Input
Examples 1:
123
Examples 2:
-380Sample Output
Examples 1:
321
Examples 2:
-83Ideas
In fact, it is to keep putting the low numbers on the high ones , You can continuously withdraw the balance 、 ride 10、 except 10 To complete .
Code
#include <iostream>
using namespace std;
int main(){
int input;
cin >> input;
int output = 0;
int r = input % 10;
while (input != 0){
r = input % 10;
input = input / 10;
output = output * 10 + r;
}
cout << output;
} 边栏推荐
- Hot spot of equity transfer: 93.75% equity transfer of Chongqing Jianke Construction Engineering Quality Inspection Co., Ltd
- Halcon knowledge: dyn_ Usage of threshold (scratch detection)
- &lt;Sicily&gt;1001. Rails
- [system architecture] - five styles of software architecture
- 手机开户有什么风险吗?开户安全吗?
- [basic knowledge] - data bit width converter
- ROS知识:读取点云数据文件
- 网络基础和框架
- What are the risks of opening a mobile account? Is it safe to open an account?
- 自己测试的范围内出现严重 BUG ,马上要上线,这种情况怎么办?
猜你喜欢

生态 | 万里数据库与卫士通完成兼容认证 共筑网络安全生态体系

Machine Learning Series 5: distance space (1)

DuPont analysis: what is the investment value of Anyang Iron and Steel Co., Ltd?

What if the test time is not enough?

Network foundation and framework

Go zero micro Service Practice Series (VI. cache consistency assurance)

网络基础和框架

QT5知识:字符串列表QStringListModel

Transformers are RNNs (linear transformer)论文阅读

mysql中innodb下的redo log什么时候开始执行check point落盘的?
随机推荐
ROS察微【51】:如何将里程计和 IMU 与 robots_localization 融合
2D laser Slam (using laser scan matcher)
AssetBundle资源管理
技术分享| WVP+ZLMediaKit实现摄像头GB28181推流播放
kubernetes comfig subpath
Transformers are RNNs (linear transformer)论文阅读
ROS knowledge: the calling practice of librviz Library
Qt5 knowledge: string list qstringlistmodel
DuPont analysis: what is the investment value of Anyang Iron and Steel Co., Ltd?
Linked list 5 - 234 Palindrome linked list
判断测试结束的标准有哪些?
R语言将距离矩阵输入给hclust函数进行层次聚类分析,使用cutree函数进行层次聚类簇的划分、参数k指定聚类簇的个数、给每个样本都分配了簇标签
R语言dplyr包filter函数过滤dataframe数据中指定数据列的内容包含指定字符串的数据行、基于grepl函数
Follow the promotional music MV of domestic tour in Thailand and travel to Bangkok like local people
[introduction to UVM== > episode_7] ~ sequence, sequence item, sequencer, driver
对象池框架
10-- construct binary tree according to middle order traversal and post order traversal
Localization information | aikesheng and China kefangde complete product compatibility and mutual certification
Runtime application self-protection (rasp): self-cultivation of application security
ROS察微【57】:配置手臂机器人来抓东西