#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. iptables说明(转)

    原文:https://www.linuxidc.com/Linux/2016-09/134832.htm 前提基础: 当主机收到一个数据包后,数据包先在内核空间中处理,若发现目的地址是自身,则传到用户 ...

  2. java学习3创建学生属性:学号、姓名、电话 完全实现对象集合的增删改查。(控制台来做)

    首先创建一个student类其中包括get,set与构造函数 /** * */package work2; /** * @author Administrator * */public final c ...

  3. DOM中的事件对象和IE事件对象

    DOM中的事件对象 IE事件对象 属性/方法 类型 读/写 说明 属性/方法 类型 读/写 说明  bubles Boolean 只读  表明事件是否冒泡  cancleBubble Boolean ...

  4. 简单的dialog,类似alert弹框

    function alertPop(content){ $.dialog({ title:"提示", width:400, height:100, padding:'5px', c ...

  5. poj 3278 Catch That Cow(bfs+队列)

    Description Farmer John has been informed of the location of a fugitive cow and wants to catch her i ...

  6. Page页面生命周期——微信小程序

    onLoad:function (options) {     //页面初始化     console.log('index Load') }, onShow:function () {     // ...

  7. day34(注解)

    注解 注解和注释的区别: 注释:是给程序员看的. 注解:是给虚拟机识别的. 注解的作用: 1.代替配置文件 2.标识一个方法,代替一个特殊功能. JDK当中的提供的注解: 标识重写方法 @Overri ...

  8. How to Start a Business in 10 Days

    With an executive staffing venture about to open, a business loan from the in-laws gnawing at her co ...

  9. java基础-day21

    第10天  IO流 今日内容介绍 u  标准输入流 & 转换流 & 打印流 u  对象操作流 u  Properties集合 第1章   标准输入流 & 转换流 & 打 ...

  10. POJ3111 K Best 2017-05-11 18:12 31人阅读 评论(0) 收藏

    K Best Time Limit: 8000MS   Memory Limit: 65536K Total Submissions: 10261   Accepted: 2644 Case Time ...