题目链接http://poj.org/problem?id=1503

思路分析: 基本的高精度问题,使用字符数组存储然后处理即可。

代码如下

#include <iostream>
#include <string>
using namespace std; const int M = + ;
char input[M];
int A[M], sum[M]; void Reverse(int A[], const char str[])
{
int len = strlen(str);
int index = ; for (int i = len - ; i >= ; --i)
A[index++] = str[i] - '';
} int main()
{
int sumLen = ; memset(sum, , sizeof(sum));
while (scanf("%s", input) != EOF)
{
int digitSum; if (strcmp(input, "") == )
break;
memset(A, , sizeof(A));
Reverse(A, input);
for (int i = ; i < M; ++i)
{
digitSum = sum[i] + A[i];
sum[i] = digitSum % ;
sum[i+] += digitSum/;
}
}
for (int i = M-; sum[i] == ; --i)
sumLen = i;
for(int i = sumLen-; i >= ; --i)
printf("%d", sum[i]);
printf("\n"); return ;
}

poj 1503 Integer Inquiry (高精度运算)的更多相关文章

  1. Poj 1503 Integer Inquiry

    1.链接地址: http://poj.org/problem?id=1503 2.题目: Integer Inquiry Time Limit: 1000MS   Memory Limit: 1000 ...

  2. POJ 1503 Integer Inquiry 大数 难度:0

    题目链接:http://poj.org/problem?id=1503 import java.io.*; import java.math.BigInteger; import java.util. ...

  3. POJ 1503 Integer Inquiry(大数相加)

    一.Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his exp ...

  4. POJ 1503 Integer Inquiry(大数相加,java)

    题目 我要开始练习一些java的简单编程了^v^ import java.io.*; import java.util.*; import java.math.*; public class Main ...

  5. POJ 1503 Integer Inquiry 简单大数相加

    Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his explo ...

  6. hdu 1047 Integer Inquiry(高精度数)

    Problem Description Oneof the first users of BIT's new supercomputer was Chip Diller. He extended hi ...

  7. Integer Inquiry【大数的加法举例】

    Integer Inquiry Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 27730   Accepted: 10764 ...

  8. (大数 string) Integer Inquiry hdu1047

    Integer Inquiry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  9. hdu acm-1047 Integer Inquiry(大数相加)

    Integer Inquiry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

随机推荐

  1. Winform获取当前程序名称或路径

    以下几种方法获取当前程序名称或路径: // 获取程序的基目录. System.AppDomain.CurrentDomain.BaseDirectory // 获取模块的完整路径.      // 获 ...

  2. 51NOD 算法马拉松8

    题目戳这里:51NOD算法马拉松8 某天晚上kpm在玩OSU!之余让我看一下B题...然后我就被坑进了51Nod... A.还是01串 水题..怎么乱写应该都可以.记个前缀和然后枚举就行了.时间复杂度 ...

  3. iOS 支持arm_64 和 x86_64 的OpenSSL 静态库(libcrypto.a, libssl.a)

    下载链接

  4. awk的用法(转)

    awk 用法:awk ' pattern {action} ' 变量名 含义 ARGC 命令行变元个数 ARGV 命令行变元数组 FILENAME 当前输入文件名 FNR 当前文件中的记录号 FS 输 ...

  5. HeapAnalyzer

    https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=4544baf ...

  6. 手工部署Sqlserver CLR程序集

    原文 手工部署Sqlserver CLR程序集 以前一直用VS部署Sqlserver CLR程序集简单省事,现在服务器部署在内网了,必须手动更新部署Sqlserver CLR程序集.    开始以为A ...

  7. Android Studio 新建项目的R文件丢失的解决方法

    最近Android Studio炒的比较热,于是笔者决定赶赶时髦,从Eclipse转到了Android Studio.不幸的是,用Android Studio创建项目的时候就遇到了一个比较尖锐的问题— ...

  8. BZOJ 3402: [Usaco2009 Open]Hide and Seek 捉迷藏

    题目 3402: [Usaco2009 Open]Hide and Seek 捉迷藏 Time Limit: 3 Sec  Memory Limit: 128 MB Description     贝 ...

  9. CTreeCtrl 控件使用总结

    一 基础操作  1 插入节点 1)插入根节点 [cpp] view plaincopy //插入根节点 HTREEITEM hRoot; CString str=L"ROOT" h ...

  10. GDI+入门——带你走进Windows图形的世界

    一.GDI+基础 1.GDI+简单介绍 GDI+是微软的新一代二维图形系统,它全然面向对象,要在Windows窗口中显示字体或绘制图形必需要使用GDI+.GDI+提供了多种画笔.画刷.图像等图形对象, ...