又是愚人节题目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;
}

亲测可以ac

题解 CF171A 【Mysterious numbers - 1】的更多相关文章

  1. 题解-Roman and Numbers

    题解-Roman and Numbers 前置知识: 数位 \(\texttt{dp}\) </> \(\color{#9933cc}{\texttt{Roman and Numbers} ...

  2. [LeetCode 题解]: Add Two Numbers

    You are given two linked lists representing two non-negative numbers. The digits are stored in rever ...

  3. leetcode 题解 Add Two Numbers(两个单链表求和)

    题目: You are given two linked lists representing two non-negative numbers. The digits are stored in r ...

  4. LeetCode题解——Add Two Numbers

    题目: 两个数字求和,数字用链表表示,每一个结点代表一位.链表顺序与数字顺序相反,即表头存放数字的最低位. 解法: 分别遍历两个链表的每个结点,对两个结点求和即可.要维护一个变量保存每次相加之后的进位 ...

  5. PAT甲级题解-1100. Mars Numbers (20)-字符串处理

    没什么好说的,注意字符串的处理,以及当数字是13的倍数时,只需高位叫法的单词.比如26,是“hel”,而不是“hel tret”. 代码: #include <iostream> #inc ...

  6. PAT甲题题解-1120. Friend Numbers (20)-水题

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789775.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  7. 题解 CF1428G Lucky Numbers (Easy Version and Hard Version)

    这题没有压行就成 \(\texttt{Hard Version}\) 最短代码解了( 要知道这题那么 \(sb\) 就不啃 \(D\) 和 \(E\) 了. \(\texttt{Solution}\) ...

  8. CF55D Beautiful numbers 题解

    题目 Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer n ...

  9. 【题解】【链表】【Leetcode】Add Two Numbers

    You are given two linked lists representing two non-negative numbers. The digits are stored in rever ...

随机推荐

  1. SSM项目下Druid连接池的配置及数据源监控的使用

    一,连接池的配置 在pom.xml中添加,druid的maven信息 <dependency> <groupId>com.alibaba</groupId> < ...

  2. Linux基础:df命令总结

    本文只总结一些常用的用法,更详细的说明见man df和 df --help. df命令 df命令用于显示目前在Linux系统上的文件系统的磁盘使用情况统计. df命令主要是从各文件系统的Super b ...

  3. Linux 文件和目录操作命令(一)

    1.cd (change directory)切换到指定目录 - 返回上次目录 .. 返回上层目录 回车 返回主目录 / 根目录 2.cp (copy)复制文件或目录 -r -R 递归复制该目录及其子 ...

  4. 【python基础语法】第6天作业练习题

    ''' 二.作业(每一道题封装成一个函数) 1.输出99乘法表,结果如下:(提示嵌套for循环,格式化输出) 2.有1 2 3 4 这四个数字,设计程序计算能组成多少个互不相同且无重复数字的3位数?分 ...

  5. Linux ps和pstree命令

    1. 查看所有进程 ps -eF -e: Select all processes.-F: Extra full format. PSR (Processor)显示进程所在的CPU. 2. 查看所有进 ...

  6. PTA Is Topological Order

    Write a program to test if a give sequence Seq is a topological order of a given graph Graph. Format ...

  7. 三维偏序[cdq分治学习笔记]

    三维偏序 就是让第一维有序 然后归并+树状数组求两维 cdq+cdq不会 告辞 #include <bits/stdc++.h> // #define int long long #def ...

  8. 吴裕雄--天生自然HADOOP操作实验学习笔记:分布式及RPC通信简介

    实验目的 掌握GOF设计模式的代理模式 了解掌握socket编程.java反射.动态代理 了解NIO.多线程 掌握hadoop的RPC框架使用API 实验原理 1.什么是RPC 在hadoop出现以前 ...

  9. echarts 【图表的基本使用】

    一.柱状图 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <tit ...

  10. linux下定时网站文件备份和数据备份以及删除旧备份标准代码

    直切正题: 文件备份:web.sh 数据备份:db.sh 删除旧备份:clear.sh vi web.sh文件内容为: #!/bin/bash        解释:shell脚本标准头 cd  网站文 ...