2019牛客暑期多校训练营(第七场)J A+B problem
链接:https://ac.nowcoder.com/acm/contest/887/J
来源:牛客网
题目描述
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.
输入
复制
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相关推荐
- 【2019牛客暑期多校训练营(第二场) - H】Second Large Rectangle(单调栈,全1子矩阵变形)
题干: 链接:https://ac.nowcoder.com/acm/contest/882/H 来源:牛客网 题目描述 Given a N×MN \times MN×M binary matrix. ...
- 2019牛客暑期多校训练营(第一场)E-ABBA(dp)
链接:https://ac.nowcoder.com/acm/contest/881/E 来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 524288K,其他语言1048 ...
- 2019牛客暑期多校训练营(第一场)
传送门 参考资料: [1]:官方题解(提取码:t050 ) [2]:标程(提取码:rvxr ) [3]:牛客题解汇总 A.Equivalent Prefixes(单调栈) •题意 定义两个数组 u,v ...
- 2019牛客暑期多校训练营(第一场) A Equivalent Prefixes ( st 表 + 二分+分治)
链接:https://ac.nowcoder.com/acm/contest/881/A 来源:牛客网 Equivalent Prefixes 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/ ...
- 【2019牛客暑期多校训练营(第二场)- E】MAZE(线段树优化dp,dp转矩阵乘法,线段树维护矩阵乘法)
题干: 链接:https://ac.nowcoder.com/acm/contest/882/E?&headNav=acm 来源:牛客网 Given a maze with N rows an ...
- 【2019牛客暑期多校训练营(第二场)- F】Partition problem(dfs,均摊时间优化)
题干: 链接:https://ac.nowcoder.com/acm/contest/882/F 来源:牛客网 Given 2N people, you need to assign each of ...
- 【2019牛客暑期多校训练营(第二场) - D】Kth Minimum Clique(bfs,tricks)
题干: 链接:https://ac.nowcoder.com/acm/contest/882/D 来源:牛客网 Given a vertex-weighted graph with N vertice ...
- 【2019牛客暑期多校训练营(第一场) - A】Equivalent Prefixes(单调栈,tricks)
题干: 链接:https://ac.nowcoder.com/acm/contest/881/A 来源:牛客网 Two arrays u and v each with m distinct elem ...
- 【2019牛客暑期多校训练营(第一场) - H】XOR(线性基,期望的线性性)
题干: 链接:https://ac.nowcoder.com/acm/contest/881/H 来源:牛客网 Bobo has a set A of n integers a1,a2,-,ana1, ...
- 2019牛客暑期多校训练营(第九场)H Cutting Bamboos(主席树+二分)
链接:https://ac.nowcoder.com/acm/contest/889/H 来源:牛客网 题目描述 There are n bamboos arranged in a line. The ...
最新文章
- 解决Win7旗舰版开机后无线网络识别非常慢的问题
- oculus rift 开发入门
- jQuery 效果函数(三)
- app手机端连接tomcat电脑端服务器
- MyEclipse显示 Install new software 在线安装插件选项
- 带项目的一些体会以及合格的 Leader 应该具备什么特质?(转)
- (三)HTML 规范
- 使用JSF 2.2功能来开发可滚动,可延迟加载的Ajax数据表
- 批量执行命令(SSH)
- 怎么安装ABBYY FineReader
- 我看Slashdot
- 按层次遍历二叉树_LeetCode | 102.二叉树的层次遍历
- jboss mysql amp amp_怎么在JBoss中配置MySQL数据库连接池让Mysql支持中文
- 透過 OpenNI / NITE 分析人體骨架(上)
- python snap7 plc db_python 用Snap7读写西门子PLC中DB块
- 笔记本电脑插入耳机只能外放,耳机没声音
- 夏天最美丽的就应该是荷花了
- 伸展树(Splay)
- 软通动力入职考试----全套
- dir 616 虚拟服务器,DIR-616(DLink)无线路由器设置指南