链接:https://ac.nowcoder.com/acm/contest/887/J
来源:牛客网

题目描述

Reversed number is a number written in arabic numerals but the order of digits is reversed. The first digit becomes last and vice versa. And all the leading zeros are omitted.
For example: the reversed number of 1234 is 4321. The reversed number of 1000 is 1.

We define reversed number of as . Given you two positive integers and , you need to calculate the reversed sum: .

输入描述:

The first line of the input gives the number of test cases, T (T≤300)T\ (T \leq 300)T (T≤300). test cases follow.

For each test case, the only line contains two positive integers: and . (1≤A,B≤231−11 \leq A, B \leq 2^{31}-11≤A,B≤231−1)

输出描述:

For each test case, output a single line indicates the reversed sum.
示例1

输入

复制

3
12 1
101 9
991 1

输出

复制22

11
2

思路:  本来想用高精度来求,反噬却总是wa,只能看大佬代码
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
using namespace std;#define ll long long
#define eps 1e-9const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;ll f(ll a)
{ll t = 0;while(a){t = t * 10 + a % 10;a /= 10;}return t;
}ll a, b;int main()
{int t;for(scanf("%d", &t); t--; ){scanf("%lld%lld", &a, &b);printf("%lld\n", f(f(a) + f(b)));}return 0;
}

转载于:https://www.cnblogs.com/RootVount/p/11344588.html

2019牛客暑期多校训练营(第七场)J A+B problem相关推荐

  1. 【2019牛客暑期多校训练营(第二场) - H】Second Large Rectangle(单调栈,全1子矩阵变形)

    题干: 链接:https://ac.nowcoder.com/acm/contest/882/H 来源:牛客网 题目描述 Given a N×MN \times MN×M binary matrix. ...

  2. 2019牛客暑期多校训练营(第一场)E-ABBA(dp)

    链接:https://ac.nowcoder.com/acm/contest/881/E 来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 524288K,其他语言1048 ...

  3. 2019牛客暑期多校训练营(第一场)

    传送门 参考资料: [1]:官方题解(提取码:t050 ) [2]:标程(提取码:rvxr ) [3]:牛客题解汇总 A.Equivalent Prefixes(单调栈) •题意 定义两个数组 u,v ...

  4. 2019牛客暑期多校训练营(第一场) A Equivalent Prefixes ( st 表 + 二分+分治)

    链接:https://ac.nowcoder.com/acm/contest/881/A 来源:牛客网 Equivalent Prefixes 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/ ...

  5. 【2019牛客暑期多校训练营(第二场)- E】MAZE(线段树优化dp,dp转矩阵乘法,线段树维护矩阵乘法)

    题干: 链接:https://ac.nowcoder.com/acm/contest/882/E?&headNav=acm 来源:牛客网 Given a maze with N rows an ...

  6. 【2019牛客暑期多校训练营(第二场)- F】Partition problem(dfs,均摊时间优化)

    题干: 链接:https://ac.nowcoder.com/acm/contest/882/F 来源:牛客网 Given 2N people, you need to assign each of ...

  7. 【2019牛客暑期多校训练营(第二场) - D】Kth Minimum Clique(bfs,tricks)

    题干: 链接:https://ac.nowcoder.com/acm/contest/882/D 来源:牛客网 Given a vertex-weighted graph with N vertice ...

  8. 【2019牛客暑期多校训练营(第一场) - A】Equivalent Prefixes(单调栈,tricks)

    题干: 链接:https://ac.nowcoder.com/acm/contest/881/A 来源:牛客网 Two arrays u and v each with m distinct elem ...

  9. 【2019牛客暑期多校训练营(第一场) - H】XOR(线性基,期望的线性性)

    题干: 链接:https://ac.nowcoder.com/acm/contest/881/H 来源:牛客网 Bobo has a set A of n integers a1,a2,-,ana1, ...

  10. 2019牛客暑期多校训练营(第九场)H Cutting Bamboos(主席树+二分)

    链接:https://ac.nowcoder.com/acm/contest/889/H 来源:牛客网 题目描述 There are n bamboos arranged in a line. The ...

最新文章

  1. 解决Win7旗舰版开机后无线网络识别非常慢的问题
  2. oculus rift 开发入门
  3. jQuery 效果函数(三)
  4. app手机端连接tomcat电脑端服务器
  5. MyEclipse显示 Install new software 在线安装插件选项
  6. 带项目的一些体会以及合格的 Leader 应该具备什么特质?(转)
  7. (三)HTML 规范
  8. 使用JSF 2.2功能来开发可滚动,可延迟加载的Ajax数据表
  9. 批量执行命令(SSH)
  10. 怎么安装ABBYY FineReader
  11. 我看Slashdot
  12. 按层次遍历二叉树_LeetCode | 102.二叉树的层次遍历
  13. jboss mysql amp amp_怎么在JBoss中配置MySQL数据库连接池让Mysql支持中文
  14. 透過 OpenNI / NITE 分析人體骨架(上)
  15. python snap7 plc db_python 用Snap7读写西门子PLC中DB块
  16. 笔记本电脑插入耳机只能外放,耳机没声音
  17. 夏天最美丽的就应该是荷花了
  18. 伸展树(Splay)
  19. 软通动力入职考试----全套
  20. dir 616 虚拟服务器,DIR-616(DLink)无线路由器设置指南

热门文章

  1. AndroidのActivity之退出返回栈(二)
  2. 获取某年某月的第一天和最后一天的Sql Server函数
  3. Java Web学习(三)数据加密方式详解
  4. 初学tornado之MVC版helloworld
  5. kafka依赖zookeeper原因解析及应用场景
  6. 解决每次从cmd进入sqlplus,都得重新设置pagesize、linesize的问题
  7. [转]IP动态切换脚本
  8. (收藏)Html相关网址
  9. 深入理解js系列一作用域是什么
  10. phantomjs安装所需依赖