题目链接>>>>>>

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

#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. 使用Sphinx生成本地的Python帮助文档

    第一步:安装Sphinx 首先我们需要安装Sphinx,如果已经安装了Anaconda,那么只需要使用如下命令即可安装,关于其中的参数 -c anaconda,可以在链接[1]中查看: conda i ...

  2. AutoML技术现状与未来展望

    以下内容是对AutoML技术现状与未来展望讲座的总结. 1.机器学习定义 <西瓜书>中的直观定义是:利用经验来改善系统的性能.(这里的经验一般是指数据) Mitchell在<Mach ...

  3. android studio 清空缓存插件

    http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2016/0308/4036.html 一个提高开发效率的ADB插件:ADB IDEA 泡在 ...

  4. 【Mysql sql inject】【入门篇】sqli-labs使用 part 4【18-20】

    这几关的注入点产生位置大多在HTTP头位置处 常见的HTTP注入点产生位置为[Referer].[X-Forwarded-For].[Cookie].[X-Real-IP].[Accept-Langu ...

  5. emmc基础技术8:操作模式3-interrupt mode

    1. 前言 eMMC总线操作包含: boot mode, device identification mode interrupt mode data transfer mode 本文主要描述inte ...

  6. camera驱动框架分析(上)【转】

    转自:https://www.cnblogs.com/rongpmcu/p/7662738.html 前言 camera驱动框架涉及到的知识点比较多,特别是camera本身的接口就有很多,有些是直接连 ...

  7. MHL技术剖析,比HDMI更强【转】

    转自:http://blog.chinaunix.net/uid-22030783-id-3294750.html MHL这个只是经常听说,没有见过的东西,现在已经非常火热了,我们才刚刚开始做,人家三 ...

  8. excel导出的时候从程序后台写到excel里的是文本,所以无法在excel中计算怎么办?

    文章引用自:http://www.cnblogs.com/rayray/p/3414452.html excel导出的时候从程序后台写到excel里的是文本,所以无法在excel中计算怎么办? 需要导 ...

  9. Flex 布局教程转载

    Flex 布局教程:语法篇 http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html Flex 布局教程:实例篇 http://www.ruan ...

  10. poj3067 二维偏序树状数组

    题解是直接对一维升序排列,然后计算有树状数组中比二维小的点即可 但是对二维降序排列为什么不信呢?? /* */ #include<iostream> #include<cstring ...