#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. 百度地图经纬度和地址互转(Java代码)

    这是基于springmvc+mybatis 的一个controller.如果不是这个框架,可以把方法实体抽到自己写的一个类中,然后再测试 package com.uwitec.controller.s ...

  2. sqlserver2008查询性能优化(文摘)

    第1章 sql查询性能调整 第4章 索引分析

  3. (5)How to let go of being a "good" person — and become a better person

    https://www.ted.com/talks/dolly_chugh_how_to_let_go_of_being_a_good_person_and_become_a_better_perso ...

  4. 第04章:MongoDB基本概念

    ① 数据库 MongoDB的一个实例可以拥有一个或多个相互独立的数据库,每个数据库都有自己的集合   集合 集合可以看作是拥有动态模式的表   文档 文档是MongoDB中基本的数据单元,类似于RDB ...

  5. call和apply的作用实例

    <script> var scopeTest = function(){ //考察了 this 的含义 window.a=2; function fn(b){ this.b = b; co ...

  6. jdk1.6的配置

    执行下列命令安装jdk1.7 /usr/lib/jvm$ sudo apt-get install openjdk-7-jdk openjdk-7-jre 会得到下面这两个文件: 查看当前jdk版本: ...

  7. Win7 IIS 部署站点遇到的问题 如 HTTP 错误 404.XX

    HTTP 错误 404.2 - Not Found 由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面. 解决办法:设置为允许-面相 =============== ...

  8. 批处理FINDSTR正则表达式用法实例分析

    1.findstr . 2.txt 或 Findstr "." 2.txt 从文件2.txt中查找任意字符,不包括空字符或空行 2.findstr .* 2.txt 或 finds ...

  9. Unix传奇

    转自 http://coolshell.cn/articles/2322.html 了解过去,我们才能知其然,更知所以然.总结过去,我们才会知道我们明天该如何去规划,该如何去走.在时间的滚轮中,许许多 ...

  10. linux初学terminal命令(1)ls、cd、su、man、pwd、useradd、passwd、cat、Ctrl+C、Ctrl+Z、Ctrl+L

    terminal命令(terminal终端对应windows 按下win(linux下叫Super键)+r,输入cmd(command,命令),召唤出来的Dos控制台) 1. ls(英文list):简 ...