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) ...
随机推荐
- HTML中标签和元素的区别
作为一个前端,相信大家最先接触应该都是HTML吧?在HTML中很多人可能都没有把什么叫标签,什么叫元素这个概念搞清楚,为了把这个大家不曾留意的易混淆的搞清楚,特作此一文彻底解决掉这个问题! 首先我们来 ...
- linux下eclipse的安装
Eclipse的安装http://java.sun.com/javace/downloads/index.jsp下载:Jdk-6u17-linux-i586.binhttp://www.eclipse ...
- 教你50招提升ASP.NET性能(十一):避免在调试模式下运行网站
(17)Avoid running sites in debug mode 招数17: 避免在调试模式下运行网站 When it comes to ASP.NET, one of the most c ...
- JAVA线程全局异常处理
大家平时写线程很多,但可能很少关注如何捕获线程的全局异常.其实jdk提供了两种捕获全局异常的方法,一种是基于整个线程类(staticsetDefaultUnaughtExceptionHandler( ...
- iOS开发——数据持久化Swift篇&iCloud云存储
iCloud云存储 import UIKit class ViewController: UIViewController { override func viewDidLoad() { super. ...
- C _数据结构 _线性表的顺序存储
#ifndef __MY_SEQLIST_H__ #define __MY_SEQLIST_H__ typedef void SeqList; typedef void SeqListNode; // ...
- skip-character-set-client-handshake 与 character-set-client-handshake
my.cnf [mysql] default-character-set = gbk [mysqld] skip-character-set-client-handshake=1 跳过mysql程序起 ...
- 第一个js程序
<html><head> <title>Untitled</title> <script >function demo(){ alert ( ...
- 几本关于PHP安全的书
几本关于PHP安全的书: Essential PHP Security php architect‘s Guide to PHP Security Pro PHP Security Securing ...
- DROP--删除表
DROP TABLE table_name; 说明: 1.必须有表的权限 2.表不能有外键约束