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. Java数据类型(一)

    1 public class VarDemo 2 { 3 public static void main(String []args){ 4 //先声明后赋值 5 int number; 6 numb ...

  2. iOS图片元数据的读写

    图片的本身就是各种图像数据的载体,包含着像素.色彩.灰度等各种数据信息,除此之外,还包含着曝光数据.日期.位置.版权等元数据(metadata). 何为图片元数据 元数据包括许多重要的信息,常用的有E ...

  3. iOS开发——网络编程OC篇&(一)XMPP简单介绍与准备

    XMPP简单介绍与准备 一.即时通讯简单介绍 1.简单说明 即时通讯技术(IM)支持用户在线实时交谈.如果要发送一条信息,用户需要打开一个小窗口,以便让用户及其朋友在其中输入信息并让交谈双方都看到交谈 ...

  4. linux僵死进程的产生与避免

      作者:lingdxuyan来源:ChinaUnix技术博客,本文版权由lingdxuyan所有,如需转载,请注明出处. 一个进程在调用exit命令结束自己的生命的时候,其实它并没有真正的被销毁, ...

  5. linux内核系统调用和标准C库函数的关系分析

    http://blog.csdn.net/skyflying2012/article/details/10044343

  6. mysql sql语句使用技巧

    mysql更新数据限制limitmysql更新时,要更新记录中某个区间的数据,只能用WHERE条件来限制了,用LIMIT只能限制更新多少条!测试如下:UPDATE products SET goods ...

  7. 【转】使用Beaglebone Black的I2C (二)——使用C语言和i2c-dev驱动

    在本博客的<使用Beaglebone Black的I2C(一)>中,介绍了BBB上无需编程对i2c总线进行读写操作的方法,本文将介绍如何在c语言程序中使用i2c-dev驱动来操作i2c设备 ...

  8. h5拖放-上传图片预览功能

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  9. 父元素onmouseover触发事件在父子元素间移动不停触发的问题

    今天写了一个侧边栏动态展开收缩的效果 <!DOCTYPE html> <html lang="en"> <head> <meta char ...

  10. 快速集成图片浏览器快速集成图片浏览器->MJPhotoBrowser的使用

    介绍: 一个比较完整的图片浏览器,高仿了新浪微博的图片浏览效果,功能包括:下载浏览互联网图片,点击缩略图全屏显示图片.当加载较大图片时会出现圆形进度条,滑动浏览所有图片.保存图片到本地相册.GIF图片 ...