1.链接地址:

http://poj.org/problem?id=1503

2.题目:

Integer Inquiry
Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 28115   Accepted: 10925

Description

One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers.
``This supercomputer is great,'' remarked Chip. ``I only wish
Timothy were here to see these results.'' (Chip moved to a new
apartment, once one became available on the third floor of the Lemon Sky
apartments on Third Street.)

Input

The
input will consist of at most 100 lines of text, each of which contains a
single VeryLongInteger. Each VeryLongInteger will be 100 or fewer
characters in length, and will only contain digits (no VeryLongInteger
will be negative).

The final input line will contain a single zero on a line by itself.

Output

Your program should output the sum of the VeryLongIntegers given in the input.

Sample Input

123456789012345678901234567890
123456789012345678901234567890
123456789012345678901234567890
0

Sample Output

370370367037037036703703703670

Source

3.思路:

4.代码:

 #include "stdio.h"
#include "string.h"
#define NUM 102
int a[NUM];
int main()
{
char b[];
int len;
int max=;
int i;
gets(b);
while(b[]-''!= || strlen(b)!=)
{
len = strlen(b);
for(i=len-;i>=;i--)
{
a[len--i]+=b[i]-'';
if(a[len--i]>=) {a[len--i+]++;a[len--i]-=;}
}
i=len;
while(a[i]>=){a[i+]++;a[i]-=;i++;}
gets(b);
}
i=NUM-;
while(a[i]==)i--;
while(i>=)
{
printf("%c",a[i]+'');
i--;
}
return ;
}

Poj 1503 Integer Inquiry的更多相关文章

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

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

  2. poj 1503 Integer Inquiry (高精度运算)

    题目链接:http://poj.org/problem?id=1503 思路分析: 基本的高精度问题,使用字符数组存储然后处理即可. 代码如下: #include <iostream> # ...

  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. Integer Inquiry【大数的加法举例】

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

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

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

  8. 424 - Integer Inquiry

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

  9. hdu1047 Integer Inquiry

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

随机推荐

  1. maven快速入门

    一.maven maven可以说是管理项目的优秀工具,管理jar包 二.mave安装 1.先安装jdk(本文不详细讲) 2.安装maven ①.maven下载   http://maven.apach ...

  2. cocos2d-x CCSpriteBatchNode

    转自:http://www.cnblogs.com/jiackyan/archive/2013/04/14/3019880.html 1.先说下渲染批次:这是游戏引擎中一个比较重要的优化指标,指的是一 ...

  3. 学习 MFC之 工具栏(二)

    对于InitToolBar()函数进行进一步解析: 1.首先声明一个全局对象:  CToolBar m_toolbar; 2.然后用create()创建toolbar: //创建ToolBar工具条 ...

  4. hadoop学习;block数据块;mapreduce实现样例;UnsupportedClassVersionError异常;关联项目源代码

    对于开源的东东,尤其是刚出来不久,我认为最好的学习方式就是能够看源代码和doc,測试它的样例 为了方便查看源代码,关联导入源代码的项目 先前的项目导入源代码是关联了源代码文件 block数据块,在配置 ...

  5. C++容器类对象函数參数问题

    总之中的一个句话:容器类对象作为函数參数,与整数类型作为函数參数的传递特性同样. 验证程序 #include "stdafx.h" #include <iostream> ...

  6. 使用pypi镜像源加速第三方库在线安装

    用easy_install和pip来安装第三方库很方便 它们的原理其实就是从Python的官方源pypi.python.org/pypi 下载到本地,然后解包安装. 不过因为某些原因,访问官方的pyp ...

  7. careercup-中等难题 17.2

    17.2 设计一个算法,判断玩家是否赢了井字游戏. 解法: 假设这个检查某人是否赢得了井字游戏的函数为HasWon,那么我们第一步要向面试官确认, 这个函数是只调用一次,还是要多次频繁调用.如果是多次 ...

  8. js中数组内置方法

    var arr = ['A','B','C','D']; length 计算数组的长度 arr.length//4 indexOf() 搜索一个指定的元素的位置 arr.indexOf('C');// ...

  9. java基础学习总结四(控制语句<顺序、选择、循环>、方法)

    一:结构控制语句 结构控制语句分为3种,顺序语句.选择语句.循环语句. 1:顺序语句 就是自上而下的执行程序,默认执行顺序. 2:选择语句 if结构语句:如果满足条件,则执行该语句. if...els ...

  10. Redis的安装与使用

    一.什么 Redis REmote DIctionary Server,简称 Redis,是一个类似于Memcached的Key-Value存储系统.相比Memcached,它支持更丰富的数据结构,包 ...