Poj 1503 Integer Inquiry
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
0Sample Output
370370367037037036703703703670Source
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的更多相关文章
- POJ 1503 Integer Inquiry 大数 难度:0
题目链接:http://poj.org/problem?id=1503 import java.io.*; import java.math.BigInteger; import java.util. ...
- poj 1503 Integer Inquiry (高精度运算)
题目链接:http://poj.org/problem?id=1503 思路分析: 基本的高精度问题,使用字符数组存储然后处理即可. 代码如下: #include <iostream> # ...
- POJ 1503 Integer Inquiry(大数相加)
一.Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his exp ...
- POJ 1503 Integer Inquiry(大数相加,java)
题目 我要开始练习一些java的简单编程了^v^ import java.io.*; import java.util.*; import java.math.*; public class Main ...
- POJ 1503 Integer Inquiry 简单大数相加
Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his explo ...
- Integer Inquiry【大数的加法举例】
Integer Inquiry Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 27730 Accepted: 10764 ...
- hdu acm-1047 Integer Inquiry(大数相加)
Integer Inquiry Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- 424 - Integer Inquiry
Integer Inquiry One of the first users of BIT's new supercomputer was Chip Diller. He extended his ...
- hdu1047 Integer Inquiry
/* Integer Inquiry Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
随机推荐
- Css3 display用法
display 属性规定元素应该生成的框的类型. display:none 此元素不会被显示 display:block 此元素将显示为块级元素,此元素前后会带有换行符 display:inl ...
- 利用UIBezierPath实现一个带圆角的视图
- (void)drawRect:(CGRect)rect { // draw a box with rounded corners to fill the view - UIBezierPath * ...
- iOS8 CLLocationManager 、CLGeocoder获取地理位置
最近在ios8.0使用CLLocationManager定位服务,发现老不能定位,查看设置菜单中的项也是处于未知状态.想起之前都有一个弹出框提示用户是否允许定位,这次一直没有出现了.原来ios8.0下 ...
- 关于android的Activity的四种启动模式
最近做项目遇到一个问题,当触摸屏幕的时候通过intent启动activity,发现会启动多次,而后查阅资料,发现,原来是activity的模式设置问题. Activity的启动模式可以通过Androi ...
- Cocos2d-x 3.x 资料整理
cocos2d-x-3.0rc0新project的分辨率设置和控制台输出信息 http://kome2000.blog.51cto.com/969562/1379704 Cocos2d-x 3. ...
- Events
Events The idea behind Events is the ability to send data, as parameters, to interested Listeners an ...
- Maven项目中如何添加日志
- Java基础知识强化之多线程笔记02:多线程之 面试题(常问)
1. 多线程有几种实现方案,分别是哪几种 ? 两种. 继承Thread类 实现Runnable接口 扩展一种:实现Callable接口.这个得和线程池结合. 2. 同步有几种方式,分别是什么? ...
- ListView中不同类型view的实现
首先创建请求队列,一个活动中只需要一个,因此放在Application中: public class MyApplication extends Application{ private static ...
- fedora 23中配置nfs-server
fedora 23中配置nfs-server */--> fedora 23中配置nfs-server Table of Contents 1. 产考资料 2. NFS配置文件 2.1. /et ...