题解 CF171A 【Mysterious numbers - 1】
又是愚人节题目qwq……
说一下题意吧:
把第1个数翻转后加第二个数
具体思路:
1.定义变量,进行输入
int a,b;
cin>>a>>b;
2.定义一个变量c,作为存储第1个数的翻转
int c;
3.写出翻转第一个数的代码
while(b!=0)
{
c*=10;
c+=b%10;
b/=10;
}
c*10指把c扩大10倍,最后一位变成0
c+=b%10指将b目前的个位数赋值给c
b/=10把b除以10最后一位则为原来的十位数
4.输出a+c即可
代码如下:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
int c=0;
while(b!=0)
{
c*=10;
c+=b%10;
b/=10;
}
cout<<a+c;
return 0;
}
题解 CF171A 【Mysterious numbers - 1】的更多相关文章
- 题解-Roman and Numbers
题解-Roman and Numbers 前置知识: 数位 \(\texttt{dp}\) </> \(\color{#9933cc}{\texttt{Roman and Numbers} ...
- [LeetCode 题解]: Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in rever ...
- leetcode 题解 Add Two Numbers(两个单链表求和)
题目: You are given two linked lists representing two non-negative numbers. The digits are stored in r ...
- LeetCode题解——Add Two Numbers
题目: 两个数字求和,数字用链表表示,每一个结点代表一位.链表顺序与数字顺序相反,即表头存放数字的最低位. 解法: 分别遍历两个链表的每个结点,对两个结点求和即可.要维护一个变量保存每次相加之后的进位 ...
- PAT甲级题解-1100. Mars Numbers (20)-字符串处理
没什么好说的,注意字符串的处理,以及当数字是13的倍数时,只需高位叫法的单词.比如26,是“hel”,而不是“hel tret”. 代码: #include <iostream> #inc ...
- PAT甲题题解-1120. Friend Numbers (20)-水题
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789775.html特别不喜欢那些随便转载别人的原创文章又不给 ...
- 题解 CF1428G Lucky Numbers (Easy Version and Hard Version)
这题没有压行就成 \(\texttt{Hard Version}\) 最短代码解了( 要知道这题那么 \(sb\) 就不啃 \(D\) 和 \(E\) 了. \(\texttt{Solution}\) ...
- CF55D Beautiful numbers 题解
题目 Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer n ...
- 【题解】【链表】【Leetcode】Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in rever ...
随机推荐
- 虚拟机中给linux 系统添加硬盘以后,进行分区挂载
当自己虚拟机中的linux 系统硬盘不够用的时候需要添加硬盘给系统使用,所以可以通过以下的步骤实现 1.关闭自己的客户机,然后执行以下步骤 2. 上面的步骤完成以后,重点来了,下面打开客户机,执行以下 ...
- Cassandra 在 360 的实践与改进
分享嘉宾:王锋 奇虎360 技术总监 文章整理:王彦 内容来源:Cassandra Meetup 出品平台:DataFunTalk 注:欢迎转载,转载请留言. 导读:2010年,Dropbox 在线云 ...
- Elasticsearch之增加和删除索引
增加索引 利用postMan工具发送restfulAPI添加索引库 请求方式为put代表添加 创建索引index时映射mapping 请求URL: 使用put发送http://localhost:92 ...
- 通过sql的stuff 把一列几行的记录拼接在一行一个字段
---通过sql的stuff 把一列几行的记录拼接在一行一个字段 select FID,a.FCustomerID as 工地ID , 应验收节点 = (stuff((select ',' + isn ...
- Remoting、WCF、WebAPI、WCFREST、WebService之间的区别与联系
在.net平台下,有大量的技术让你创建一个服务,像Web Service,WCF,Web API,Remoting,我们来对比一下他们的区别与联系 Remoting Web Service WCF W ...
- 拓展lucas结论及模板
lucas及其拓展 模板题 洛谷 P4720 本文侧向结论和代码实现, 推导请转至lucas定理及其拓展的推导 https://blog.csdn.net/yuyilahanbao/article/d ...
- Apache Avro总结
参考 Apache Avro™ 1.9.0 Specification Avro介绍 小而巧的数字压缩算法:zigzag 原始类型(Primitive Types) 类型名 描述 描述 二进制编码 ...
- OpenCV学习记录(C++版本)
HighGUI组件 图像的载入:imread()函数 Mat imread(const string& filename, int flag = 1)其中flag=1代表读入RGB彩色图像,- ...
- egg 提交数据 防csrf 攻击 配置
await ctx.render('from',{csrf:this.ctx.csrf}); 或者 使用中间件 ctx.state.csrf = ctx.csrf;
- Python的入门级试用(简明教程)
声明:借鉴Python 简明教程 用 Python 编写的传统的 'Hello World' 程序.使用 Python 运行你的程序的方法有两种:使用交互式解释器提示符或者使用源文件.现在我们来看一下 ...