V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
automaton0018
V2EX  ›  C

[c++] 新手 求解一道题(最好带注释)

  •  
  •   automaton0018 · 2018-06-29 13:54:31 +08:00 · 2317 次点击
    这是一个创建于 2365 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Calculate a + b

    Input The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.

    Output For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.

    Sample Input 1 2 3 4 5 6 Sample Output 3 7 11

    Calculate A + B

    Input and output are the same with problem 1001. But A and B are big non-negative integers. The biggest integer is less than 10^500.

    Sample Input

    1234567890987654321 9876543210123456789 123456789123456789 321654987321654987 9081321110693270343633073697474256143563558458718976746753830538032062222085722974121768604305613921745580037409259811952655310075487163797179490457039169594160088430571674960498834085812920457916453747019461644031395307920624947349951053530086146486307198155590763466429392673709525428510973272600608981219760099374675982933766845473509473676470788342281338779191792495900393751209539300628363443012 6538005862664913074813656220643842443844131905754565672075358391135537108795991638155474452610874309742867231360502542308382199053675592825240788613991898567277116881793749340807728335795394301261629479870548736450984003401594705923178314906195914825136973281314862289454100745237769034410057080703111299605127114594552921209928891515242515620324828055912854227507525717981351447473570262981491527798 Sample Output

    11111111101111111110 445111776445111776 15619326973358183418446729918118098587407690364473542418829188929167599330881714612277243056916488231488447268769762354261037509129162756622420279071031068161437205312365424301306562421608314759178083226890010380482379311322219653273129368436282061311444171436905625755883493418947294462921030353303720280824887213969228904143695736988751989296795616398194193006699318213881745198683109563609854970810

    5 条回复    2018-06-30 15:38:21 +08:00
    ngg0707
        1
    ngg0707  
       2018-06-29 15:01:47 +08:00
    大数相加?
    lance6716
        2
    lance6716  
       2018-06-29 15:55:15 +08:00
    高精度加法
    automaton0018
        3
    automaton0018  
    OP
       2018-06-29 16:31:08 +08:00
    是的
    Yzstr
        4
    Yzstr  
       2018-06-29 18:25:15 +08:00 via iPhone
    自己写一个 longInt 类 开数组来记录数据 重载一下加法来实现长整数相加
    wutiantong
        5
    wutiantong  
       2018-06-30 15:38:21 +08:00
    最好带注释?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1449 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 19ms · UTC 17:13 · PVG 01:13 · LAX 09:13 · JFK 12:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.