设为首页 加入收藏

TOP

UVA424 - Integer Inquiry
2014-11-23 17:44:35 来源: 作者: 【 】 浏览:6
Tags:UVA424 Integer Inquiry

题目链接:UVA424

大数相加问题,模拟手算即可,具体看代码:


 
#include   
#include   
#include   
using namespace std;  
char number[255]={'0'};  
int answer[260]={0};  
void reverse(char* pointer);  
int main()  
{  
    int maxIndex=0;  
    while(scanf("%s",number)&&strcmp(number, "0"))  
    {  
        int length=strlen(number);  
        reverse(number);  
        int index;  
        int carryBit=0;  
        for(index=0;indexmaxIndex)  
            maxIndex=index;  
    }  
    int flag=1;  
    for(int i=maxIndex;i>0;i--)  
    {  
        if(flag)  
        {  
            if(answer[i])  
            {  
                cout< 
 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇HDU 1104 Remainder (BFS(广度优.. 下一篇hdu1700 Points on Cycle (数学)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·请问c语言刚入门,该 (2025-12-26 10:21:04)
·python 编程怎么定义 (2025-12-26 10:21:01)
·09-指 针 (一)-c语言 (2025-12-26 10:20:58)
·About - Redis (2025-12-26 08:20:56)
·Redis: A Comprehens (2025-12-26 08:20:53)