#include <iostream>
#include <string>
#include <algorithm>
#define MAXN 350
using namespace std; int _m[MAXN]; int main()
{
//freopen("acm.acm","r",stdin);
int n;
string s_1;
string s_2;
int len_1;
int len_2;
int min;
int i;
int j;
int time = ;
bool boo;
cin>>n; while(n --)
{ cin>>s_1>>s_2;
boo = false;
len_1 = s_1.length();
len_2 = s_2.length();
if(len_1 > len_2)
{
iter_swap(&s_1,&s_2);
} min = s_2.length() - s_1.length();
for(i = ; i < min; ++ i)
{
_m[i] = s_2[i] - '';
}
j = ;
for(i = min; i < s_2.length(); ++ i)
{
_m[i] = (s_2[i] - '') + (s_1[j] - '');
++ j;
} int tem = ; for(i = s_2.length() - ; i >= ; -- i)
{
_m[i] += tem;
tem = _m[i]/;
_m[i] %= ;
}
cout<<++time<<" ";
if(tem != )
{
cout<<tem;
boo = true;
}
i = ;
if(tem == )
{
while(_m[i] == )
{
++ i;
}
}
for(; i < s_2.length(); ++ i)
{ cout<<_m[i];
boo = true;
}
if(!boo)
{
cout<<;
}
cout<<endl;
}
}

POJ 2845的更多相关文章

  1. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  2. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  3. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  4. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  5. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

  6. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

  7. POJ 2255. Tree Recovery

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11939   Accepted: 7493 De ...

  8. POJ 2752 Seek the Name, Seek the Fame [kmp]

    Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 17898   Ac ...

  9. poj 2352 Stars 数星星 详解

    题目: poj 2352 Stars 数星星 题意:已知n个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...

随机推荐

  1. 2018.10.27 bzoj1984: 月下“毛景树”(树链剖分)

    传送门 唉蒟蒻又退化了,这道sb题居然做了20min,最后发现是updcovupdcovupdcov写成了updaddupdaddupdadd我还能说什么233233233 就是让你转边权为点权之后, ...

  2. php多表查询数据合并,避免foreach循环嵌套

    $memberList = $member->getMemberList(); $members = []; if (is_array($memberList)) { foreach ($mem ...

  3. layer 弹框不显示内容

    // layer的弹框不显示信息 可能是背景颜色和字体颜色冲突 改下字体颜色即可 layer.msg('<p style="color:black">用户名不能为空&l ...

  4. 非关系型数据库MongoDB

    爆炸式发展的NoSQL技术 在过去的很长一段时间中,关系型数据库(Relational Database Management System)一直是最主流的数据库解决方案,他运用真实世界中事物与关系来 ...

  5. Github上下载某一个文件夹

    1.安装svn sudo apt-get install subversion 2.修改下载文件夹的链接 例如,https://github.com/a***b/learn/tree/master/m ...

  6. java并发里的一些基础概念

    转载自:https://my.oschina.net/hosee/blog/597934: 摘要: 本系列基于炼数成金课程,为了更好的学习,做了系列的记录. 本文主要介绍 1.高并发的概念,为以后系列 ...

  7. shell常用符号的意义

    转自:http://blog.sina.com.cn/mo0928 感谢原作者!!! 跟網路農夫了解UNIX SHELL-(Bash scripting 简介 第四章 特殊符号) (2007-08-1 ...

  8. nginx 下载 大文件被截断

    如果出现大文件被截断,且ngix的日志大量出现以下类似报错: 则说明是nginx没有fastcgi_temp的读写权限.其中fastcgi_temp是自己的文件夹名称,每个人的不同且路径也会不同,这个 ...

  9. [指南] 15分钟学会MySQL(Linux版)

    原文链接:http://www.mysqlpub.com/thread-348-1-1.html 原创出处:MySQLpub.com  , 作者:kider  ,转载请注明作者和出处,并不能用于商业用 ...

  10. Cacti Install Error

    Cacti Error happened while installing: ERROR: Your MySQL TimeZone database is not populated. Please ...