1503 Integer Inquiry
来源:互联网 发布:关键词优化有什么用 编辑:程序博客网 时间:2024/05/01 00:43
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
Sample Output
Source
East Central North America 1996
*************************************************************************************************
*********************************************************************************************
#include<stdio.h>#include<string.h>int main(){int a[200]; char b[200];int i;for(i=0;i<200;i++)a[i]=0;while(1){scanf("%s",b);if(strcmp(b,"0")==0)break;strrev(b);for(i=0;b[i]!='/0';i++)a[i]+=(b[i]-'0');}for(i=1;i<200;i++){a[i]+=a[i-1]/10;a[i-1]=a[i-1]%10;} for(i=199;a[i]==0;i--);for(i;i>=0;i--)printf("%d",a[i]); printf("/n");return 0;}
370370367037037036703703703670
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678900
- POJ – 1503 Integer Inquiry Integer Inquiry
- 1503 Integer Inquiry
- pku 1503 Integer Inquiry
- POJ 1503 Integer Inquiry
- poj 1503 Integer Inquiry
- POJ 1503 Integer Inquiry
- poj 1503 Integer Inquiry
- POJ 1503 Integer Inquiry
- 1503 Integer Inquiry
- POJ 1503 Integer Inquiry
- POJ---1503 Integer Inquiry
- poj 1503 Integer Inquiry
- POJ 1503 Integer Inquiry
- POJ 1503Integer Inquiry
- POJ 1503 Integer Inquiry
- POJ 1503 Integer Inquiry
- poj 1503 Integer Inquiry
- POJ-1503 Integer Inquiry
- 微软研究院邹欣:笔试阅卷有感
- .net三层结构的简单理解
- 设置OpenGL编程环境
- 1597
- 1519 Digital Roots
- 1503 Integer Inquiry
- 1468 Rectangles
- 1432 Decoding Morse Sequences
- JBuilder中使用SQL server 2000时的配置步骤
- 1313 Booklet Printing
- 1251 Jungle Roads
- 浅谈数据库设计技巧(转经典)
- 1239 Increasing Sequences
- 网站栏目