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

Description

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

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

题目描述:输入多个大数,求其和,输入以0结束。
代码:

 #include<iostream>
#include<string.h>
#include<stdlib.h>
using namespace std;
int main()
{
char f1[];
int sum[]={},i,j;
cin>>f1;
while(strcmp(f1,"")!=)
{
int t=strlen(f1),f[]={};
for(i=t-,j=;i>=;i--,j++)
f[j]=f1[i]-'';
int up=;
for(j=;j<=;j++)
{
int s=f[j]+sum[j]+up;
sum[j]=s%;
up=s/;
}
cin>>f1;
}
for(i=;i>=;i--)
if(sum[i]!=)
{
while(i>=)
{
cout<<sum[i];
i--;
}
break;
}
cout<<endl;
return ;
}

Integer Inquiry【大数的加法举例】的更多相关文章

  1. Integer Inquiry 大数加法

    Integer Inquiry 1 import java.util.*; 2 import java.math.*; 3 import java.io.*; 4 import java.text.* ...

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

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

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

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

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

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

  5. HDU 1047 Integer Inquiry 大数相加 string解法

    本题就是大数相加,题目都不用看了. 只是注意的就是HDU的肯爹输出,好几次presentation error了. 还有个特殊情况,就是会有空数据的输入case. #include <stdio ...

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

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

  7. Integer Inquiry(大数相加)

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

  8. HDU 1047 Integer Inquiry( 高精度加法水 )

    链接:传送门 思路:高精度水题 /************************************************************************* > File ...

  9. UVa 424 Integer Inquiry 【大数相加】

    解题思路:因为给定的数据是多组,所以我们只需要多次做加法就可以了,将上一次的和又作为下一次加法运算的一个加数. 反思:还是题意理解不够清楚,最开始以为只是算三个大数相加,后来才发现是多个,然后注意到当 ...

随机推荐

  1. 值得订阅的Android 开发者博客

    链接:http://www.zhihu.com/question/19788650/answer/60771437来源:知乎 Google 官方[Android Developers Blog](An ...

  2. 关于vco

    关于vco:vco是vSphere 4开始,在vCenter中默认附件安装的一个新组件.它的作用主要是提供工作流管理.这么说可能有些抽象,让人搞不明白vco到底是做什么用的.其实很简单,以前的vCen ...

  3. 15 BasicHashTable基本哈希表类(二)——Live555源码阅读(一)基本组件类

    这是Live555源码阅读的第一部分,包括了时间类,延时队列类,处理程序描述类,哈希表类这四个大类. 本文由乌合之众 lym瞎编,欢迎转载 http://www.cnblogs.com/oloroso ...

  4. 解决ubuntu下安装mysql使用service无法启动问题

    启动的时候发现service mysql start Rather than invoking init scripts through /etc/init.d, use the service(8) ...

  5. java文件和文件夹复制、删除、移动操作

    java文件和文件夹复制.删除.移动操作 import java.io.File; import java.io.FileInputStream; import java.io.FileOutputS ...

  6. java socket client

    用tornado做了个socket server.无奈联调的人员对接不上. 于是撸出了以下demo import java.io.*; import java.net.*; public class ...

  7. matplotlib绘制直方图【柱状图】

    代码: def drawBar(): xticks = ['A', 'B', 'C', 'D', 'E']#每个柱的下标说明 gradeGroup = {'A':200,'B':250,'C':330 ...

  8. vncserver改变屏幕分辨率

    vncserver -geometry 1600x1200 转自: http://stackoverflow.com/questions/15816/changing-the-resolution-o ...

  9. 使用Axis2编写webservice客户端,服务端

    1.编写客户端 Axis2开发WebService客户端 的3种方式 [参考帖子] http://blog.csdn.net/wangjinwei6912/article/details/851259 ...

  10. JQ引用

    <script type="text/javascript" src="http://files.cnblogs.com/914556495wxkj/jquery- ...