题目链接>>>>>>

题目大意:
手动模拟大数加法,从而进行两个大数的加法运算

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
#define MAXN 3000
int a[MAXN], b[MAXN];

int main()
{
    int t;
    scanf(;
    getchar(); int array[MAXN];
    while (t--)
    {

        memset(a, , sizeof(a));
        memset(b, , sizeof(b));
        memset(array, , sizeof(array));
        ], arr2[];
        scanf("%s", arr1); int len1 = strlen(arr1);
        , j = ; i >= ; i--, j++)
        {
            a[j] = arr1[i] - ';
        }
        scanf("%s", arr2); int len2 = strlen(arr2);
        , j = ; i >= ; i--, j++)b[j] = arr2[i] - ';
        int lenoo = max(len1, len2);
        ;
        int i;
        ; i<lenoo; i++)
        {
            array[i] = ((a[i] + b[i]) + c) % ;
            c = (a[i] + b[i] + c) / ;
        }
        if (c)
        {
            array[i] = array[i] + c; lenoo += ;
        }
        printf("Case %d:\n", ++ans);
        ; i >= ; i--)printf("%d", a[i]); printf(" + ");
        ; i >= ; i--)printf("%d", b[i]); printf(" = ");
        ; i >= ; i--)printf("%d", array[i]);
        printf("\n");
        if (t)printf("\n");
    }
    ;
}

2018-04-09

hdu 1002 A + B Problem II【大数加法】的更多相关文章

  1. HDU 1002 A + B Problem II(高精度加法(C++/Java))

    A + B Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  2. 抓起根本(二)(hdu 4554 叛逆的小明 hdu 1002 A + B Problem II,数字的转化(反转),大数的加法......)

    数字的反转: 就是将数字倒着存下来而已.(*^__^*) 嘻嘻…… 大致思路:将数字一位一位取出来,存在一个数组里面,然后再将其变成数字,输出. 详见代码. while (a) //将每位数字取出来, ...

  3. 大数加法~HDU 1002 A + B Problem II

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1002 题意: 数学题,A+B; 思路,这个数非常大,普通加法一定会超时,所以用大数加法.大数加法的基 ...

  4. HDU 1002 A + B Problem II

    A + B Problem II   Time Limit: 1000MS      Memory Limit: 65536K Total Submissions: 16104    Accepted ...

  5. HDU 1002 A + B Problem II(大整数相加)

    A + B Problem II Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u De ...

  6. A + B Problem II 大数加法

    题目描述: Input The first line of the input contains an integer T(1<=T<=20) which means the number ...

  7. HDU 1002 A + B Problem II (大数加法)

    题目链接 Problem Description I have a very simple problem for you. Given two integers A and B, your job ...

  8. hdu 1002 A + B Problem II(大数)

    题意:就是求a+b (a,b都不超过1000位) 思路:用数组存储 第一道大数的题目,虽然很水,纪念一下! 代码: #include<cstdio> #include<cstring ...

  9. HDU 1002 A + B Problem II( 高精度加法水 )

    链接:传送门 题意:A + B 高精度,板子题 /************************************************************************* & ...

随机推荐

  1. mysql数据库导出excel xml等格式文件

    http://jingyan.baidu.com/article/ac6a9a5e43a62e2b653eac83.html

  2. id特性

    每一个HTML元素都可以附带id特性,id特 <!DOCTYPE html> <!-- To change this license header, choose License H ...

  3. python - 计算器 程序练习

    v1.0 计算器(数据内不含括号方式:) import re def jisuan(a,b,c): sun_count = 0 if c =="+": sun_count = st ...

  4. DSO windowed optimization 公式

    这里有一个细节,我想了很久才想明白,DSO 中的 residual 联系了两个关键帧之间的相对位姿,但是最终需要优化帧的绝对位姿,中间的导数怎么转换?这里使用的是李群.李代数中的Adjoint. 参考 ...

  5. SpringBoot注解把配置文件自动映射到属性和实体类实战

    SpringBoot注解把配置文件自动映射到属性和实体类实战 简介:讲解使用@value注解配置文件自动映射到属性和实体类 1.配置文件加载 方式一 1.Controller上面配置 @Propert ...

  6. 基于神经网络的颜色恒常性—Fully Convolutional Color Constancy with Confidence-weighted Pooling

    论文地址: http://openaccess.thecvf.com/content_cvpr_2017/papers/Hu_FC4_Fully_Convolutional_CVPR_2017_pap ...

  7. iptables学习笔记_____摘自朱双印个人日志 ____http://www.zsythink.net/

    iptables为我们预先定义了四张表 raw.mangle.nat.filter filter表负责过滤:允许那些ip访问.拒绝那些ip访问.允许那些端口...是最常用的表 #查看表里面所有的规则i ...

  8. 【转】PyDev Eclipse使用技巧说明

    PyDev Package Explorer 创建项目 在开展工作之前,需要创建一个新的项目.在 Eclipse 菜单栏中,选择 File > New > Project > Pyd ...

  9. git安装及基础用法

    1.安装GitGit-2.9.3-64-bit.exe 2.打开Git Bash,设置用户名,Email $ git config --global user.name "Your Name ...

  10. sqlserver数据库系统性能监控步骤

    1.部署好环境JDK+tomcat+数据库 ①修改数据库连接账号密码db.properties ②修改applicationContext.xml文件,开启任务 <bean id="o ...