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

East Central North America 1996

3.思路:

4.代码:

 1 #include "stdio.h"
 2 #include "string.h"
 3 #define NUM 102
 4 int a[NUM];
 5 int main()
 6 {
 7     char b[102];
 8     int len;
 9     int max=0;
10     int i;
11     gets(b);
12     while(b[0]-'0'!=0 || strlen(b)!=1)
13     {
14         len = strlen(b);
15         for(i=len-1;i>=0;i--)
16         {
17             a[len-1-i]+=b[i]-'0';
18             if(a[len-1-i]>=10) {a[len-1-i+1]++;a[len-1-i]-=10;}
19         }
20         i=len;
21         while(a[i]>=10){a[i+1]++;a[i]-=10;i++;}
22         gets(b);
23     }
24     i=NUM-1;
25     while(a[i]==0)i--;
26     while(i>=0)
27     {
28         printf("%c",a[i]+'0');
29         i--;
30     }
31    return 0;
32 }

转载于:https://www.cnblogs.com/mobileliker/p/3556808.html

Poj 1503 Integer Inquiry相关推荐

  1. hdu 1047 Integer Inquiry

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1047 Integer Inquiry Description One of the first use ...

  2. HDOJ 1047 Integer Inquiry

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

  3. POJ 1716 Integer Intervals 差分约束

    题目:http://poj.org/problem?id=1716 1 #include <stdio.h> 2 #include <string.h> 3 #include ...

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

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

  5. ZOJ 1292 Integer Inquiry

    https://zoj.pintia.cn/problem-sets/91827364500/problems/91827364791 题意:先输入一个数  表示测试样例的个数,接着输入几个数(可以不 ...

  6. POJ 1716 Integer Intervals【差分约束】

    题意: 知道了数轴上的n个区间,每个区间都是连续的int区间,现在要在数轴上任意取一堆元素,构成一个元素集合V要求每个区间和元素集合V的交集至少有两个不同的元素 求集合V最小的元素个数. 转一分析:( ...

  7. POJ 1716 Integer Intervals

    POJ_1716 由于有了前面几个题目的基础,解答这个题目的过程还算顺利.我们设S[i]为区间[0,i)内选取的数字的数量,那么有①S[b+1]-S[a]>=2,②S[i+1]-S[i]> ...

  8. Integer Inquiry

    java大数加法 import java.io.*; import java.math.*; import java.util.*;public class Main {public static v ...

  9. (精)【ACM刷题之路】POJ题目详细多角度分类及推荐题目

    POJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094) 初期: ...

最新文章

  1. 报错: eclipse加载maven工程提示pom.xml无法解析org.apache.maven.plugins:maven-resources-plugin:2.3.2...
  2. 框架:spring、springmvc、springboot
  3. python笔记之序列(tuple的基本使用和常用操作)
  4. java 判断请求为 ajax请求_请问如何判断一个请求是不是ajax请求?
  5. java声明公共构造函数_确保控制器具有无参数的公共构造函数错误
  6. OpenShift 4.3 - 基于虚拟机的BareMetal离线安装(7-9)
  7. Filter In Baan!
  8. javamelody 使用
  9. Linux系统下查看网卡的UUID
  10. Go语言安装配置运行
  11. 3 staruml 流程图,staruml流程图(staruml怎么画顺序图)
  12. 关于telnet逛bbs论坛
  13. 建站手册-网站构建:万维网联盟(World Wide Web Consortium)
  14. 2017中国北京艺术与框业展览会(AFAEXPO)会刊(参展商名录)
  15. Espresso的详细使用
  16. Online Generation of Collision-Free Trajectories for Quadrotor Flight in Unknown Cluttered Environme
  17. 如需定义元素内容与边框间的空间,可使用 padding 属性,并可使用负值?
  18. Python 解析爬取的车次数据(12306)
  19. 重装系统win11服务器未响应怎么修复操作
  20. python智能写作_闲人AI写作智能文章生成-文章伪原创-关键词生成文章工具

热门文章

  1. php基础编程教程 pdf,手把手教你编程打印出PDF_PHP教程
  2. 服务器用netstat卡_PHP安全:服务器端口安全
  3. C++安全方向openssl(一):1.1 openssl3.0介绍以及在windows2019下使用vs2019
  4. python求最大公因数函数_面试试讲 | 17学员音频示范《最大公约数》+教案+试讲稿...
  5. 研华自动驾驶计算机,ADVANTECH研华TPC-1582H-433BE 工业平板电脑一体机计算机工控机...
  6. vue element Form-Item prop
  7. SQLAlchemy create_engine
  8. javascript window.screen
  9. linux 内核/proc
  10. 2.9 什么是端到端的深度学习