CSUOJ_1002
/*
* Title : A+B(III)
* Data : 2016/11/09
* Author : Andrew
*/ #include <iostream>
#include <cstring> int main() {
std::string str1, str2;
while (std::cin >> str1 >> str2) {
int a[], b[], len;
memset(a, , sizeof(a));
memset(b, , sizeof(b));
if (str1 == "" && str2 == "") {
break;
}
a[] = str1.length();
b[] = str2.length();
for (int i = ; i <= a[]; ++i)
a[i] = str1[a[] - i] - '';
for (int j = ; j <= b[]; ++j)
b[j] = str2[b[] - j] - '';
len = (a[] > b[] ? a[] : b[]);
for (int i = ; i <= len; i++) {
a[i] += b[i];
a[i + ] += a[i] / ;
a[i] %= ;
}
len++;
while ((a[len] == ) && (len > ))
len--;
for (int i = len; i >= ; i--)
std::cout << a[i];
std::cout << std::endl;
}
return ;
}
CSUOJ_1002的更多相关文章
- python 脚本开发实战-当当亚马逊图书采集器转淘宝数据包
开发环境python2.7.9 os:win-xp exe打包工具pyinstaller 界面tkinter ============================================= ...
随机推荐
- Leetcode: Serialize and Deserialize BST
Serialization is the process of converting a data structure or object into a sequence of bits so tha ...
- Android 自定义view (一)——attr 理解
前言: 自定义view是android自定义控件的核心之一,那么在学习自定义view之前,我们先来了解下自定义view的自定义属性的attr的用法吧 Android attr 是什么 (1)attr ...
- git commit 代码时提示: Warning: Your console font probably doesn‘t support Unicode.
git 提交代码是会遇到以下问题, git commit 代码时提示: Warning: Your console font probably doesn‘t support Unicode. If ...
- iptables四个表与五个链间的处理关系
转载自:http://www.linuxidc.com/Linux/2012-08/67505.htm netfilter/iptables IP 信息包过滤系统是一种功能强大的工具,可用于添加.编辑 ...
- C与C++中的常用提高程序效率的方法
1.用a++和++a及a+=1代替a=a+1,用a--和--a及a-=1代替a=a-1 通常使用若把一个函数定义为内联函数,则在程序编译阶段,编译器就会把每次调用该函数的地方都直接替换为该函数体中的代 ...
- 在access中如何创建数据库。你认为数据库在网站开发中所扮演的角色是什么。使用数据库和使用文件,两者的优缺点各是什么。
首先在access里面填写所用的信息,将数据库创建,在导入程序设计里进行完成代码. 首先打开我们的access程序,打开方法是单击开始——所有程序. 所有程序中找到microsoft office文件 ...
- 关于在linux中使用图形界面的网络管理工具
有好几种自动设置的工具可以选择(既然说是自动设置的工具,那就说明有手动设置的工具,例如 使用 ip, iw, iwconfig 这些命令设置网络),例如:Connman, netctl, Networ ...
- js 获取根目录 获取参数
function getRootPath() { //获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp var curWwwPath ...
- java String 详解
1.java语言的字符串序列是通过字符串类实现的.java提供了3个字符串类:String类.StringBuilder类和StringBuffer类.String类是不变字符串,StringBuff ...
- Masonry 创建Button的简单使用
代码创建控制器,控件在实际开发中很实用,方便快捷,而Masonry第三方框架更是将代码创建效率提高了很多! 如何代码创建?如何使用第三方框架? 1.首先删除系统自带的SB,详见下图 2.在AppDel ...