题目链接: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. OpenGL 4 : 一个漂亮的心 For you, My Love

    画一个心形有非常多公式能够使用,以下这个公式我觉得最完美了: float x = R * 16 * pow(sin(theta), 3); float y = R * (13 * cos(theta) ...

  2. Android导航栏ActionBar的具体分析

    尊重原创:http://blog.csdn.net/yuanzeyao/article/details/39378825 关于ActionBar,相信大家并不陌生,可是真正能够熟练使用的也不是许多,这 ...

  3. SQL Server索引进阶:第四级,页和区

    原文地址: Stairway to SQL Server Indexes: Level 4, Pages and Extents 本文是SQL Server索引进阶系列(Stairway to SQL ...

  4. HTML5API___geolocation

    地理位置查询:geolocation window.navigator.geolocation 该对象下总共有3个方法 Geolocation {getCurrentPosition: functio ...

  5. using的用法

    1.using指令.using + 命名空间名字.命名空间名字可以是系统本有,也可是自己定义的class. 2.using别名.using + 别名 = 包括详细命名空间信息的具体的类型. 达成条件: ...

  6. BEGIN_SINK_MAP(CMainDlg) SINK_ENTRY(IDC_EXPLORER1, ..。响应不到的

    </pre><pre name="code" class="cpp"> class CMainDlg : public CAxDialo ...

  7. BZOJ 1816: [Cqoi2010]扑克牌( 二分答案 )

    二分答案.. 一开始二分的初始右边界太小了然后WA,最后一气之下把它改成了INF... -------------------------------------------------------- ...

  8. selenium 学习笔记 ---新手学习记录(4) 问题总结(java)-autoit3脚本使用

    1.安装autoit3 下载地址:点我下载 (提取码:9633) 提取码 下载完成后,一直下一步即可 2.上传头像使用脚本 代码如下: ControlFocus("打开",&quo ...

  9. [转]JSon数据解析的四种方式

    转至http://blog.csdn.net/enuola/article/details/7903632 作为一种轻量级的数据交换格式,json正在逐步取代xml,成为网络数据的通用格式. 有的js ...

  10. Teclast/台电 P98HD四核测评9.7寸台电P98HD 评测体验 (转载)

    自从苹果新iPad上市推出后,拥有Retina高清屏幕分辨率的平板让我们的视线一下子变得“清晰”起来,超高2048x1536分辨率也成为厂商们追捧的对象,在经历了双核时代配备高清分辨率对于硬件性能承载 ...