Integer Inquiry

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9196    Accepted Submission(s): 2354

Problem 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.

This problem contains multiple test cases!

The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.

The output format consists of N output blocks. There is a blank line between output blocks.

 
Sample Input
1
 
123456789012345678901234567890
123456789012345678901234567890
123456789012345678901234567890
0
 
Sample Output
370370367037037036703703703670
 
Source
 
 
这道题题目的意思是要求你求大数的加法,此点没什么难度,但是为啥让无数人错的一塌糊涂勒!!还是在于他奇特的要求:
  
题目中说道的就不说了;
给出的最后一0,哪里的猫腻还是挺多的...
他直接造成下面的几组奇特数据:
当你输入
  3
 
12
1
0
 
000
00
0
 
0
output
13
 
0
 
0
 
实现代码如下....
 #include<cstdio>
#include<string>
#define maxn 2200
int main()
{
char a[maxn]={'\0'};
int sum[maxn+]={};
int inta[maxn]={};
int n;
scanf("%d",&n);
for(int k=;k<n;k++)
{
int i;
memset(sum,,sizeof sum);
while()
{
scanf("%s",a);
if(*a==''&&*(a+)=='\0')break; int len=strlen(a)-;
for( i= ; i<=len; i++ )
inta[i]=a[len-i]-'';
int c=;
for(i= ; i<maxn; i++)
{
sum[i]+=inta[i]+c ;
c=sum[i]/;
sum[i]%=;
}
memset(a,'\0',sizeof a);
memset(inta,,sizeof inta);
} if(k!=)puts(""); for(i=maxn;sum[i]==&&i>;i--); for(int j=i;j>=;j--)
printf("%d",sum[j]); puts("");
}
return ;
}

HDUOJ-----1074 Integer Inquiry的更多相关文章

  1. hdu acm-1047 Integer Inquiry(大数相加)

    Integer Inquiry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  2. Integer Inquiry【大数的加法举例】

    Integer Inquiry Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 27730   Accepted: 10764 ...

  3. 424 - Integer Inquiry

     Integer Inquiry  One of the first users of BIT's new supercomputer was Chip Diller. He extended his ...

  4. hdu1047 Integer Inquiry

    /* Integer Inquiry Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...

  5. Integer Inquiry

    Integer Inquiry Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u Sub ...

  6. hdu 1047 Integer Inquiry

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

  7. UVa 424 Integer Inquiry

    之前杭电上也做过a + b的高精度的题,不过这道题的区别是有多组数据. 之前做的时候开了3个字符数组a,b,c,在计算的时候还要比较a,b长度,短的那个还要加'0',还设置了一个add来存放进位. 现 ...

  8. Poj 1503 Integer Inquiry

    1.链接地址: http://poj.org/problem?id=1503 2.题目: Integer Inquiry Time Limit: 1000MS   Memory Limit: 1000 ...

  9. hdoj 1047 Integer Inquiry

    Integer Inquiry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  10. Problem D: Integer Inquiry

    Problem D: Integer InquiryTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 41 Solved: 12[Submit][Status ...

随机推荐

  1. Recover Binary Search Tree leetcode java

    题目: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without chan ...

  2. 网页重构应该避免的10大 CSS 糟糕用法

    对于网页重构来说,CSS禅意花园 是网页布局从 table 表格转到了 html +css 的标志 .这些年来,随着我们的网站越来越复杂:html5,css3,新的技术.新的属性,越来越多的开发者开始 ...

  3. android Logger 一二三

    我们在开发Android应用的过程中可以很方便地使用Log信息来调试程序,这都归功于Android的Logger驱动为用户层提供的Log支持.无论是底层的源代码还是上层的应用,我们都可以使用Logge ...

  4. Kaggle 商品销量预测季军方案出炉,应对时间序列问题有何妙招

    https://www.leiphone.com/news/201803/fPnpTdrkvUHf7uAj.html 雷锋网 AI 研习社消息,Kaggle 上 Corporación Favorit ...

  5. 转:git设置过滤忽略的文件或文件夹

    from: https://www.cnblogs.com/foohack/p/4629255.html git设置过滤忽略的文件或文件夹   我们一般向代码仓库提交项目的时候,一般需要忽略编译生成的 ...

  6. unity3d Player Settings 中的Stripping Level(剥离等级)对应每个等级具体剥离了哪些库

    http://docs.unity3d.com/410/Documentation/ScriptReference/MonoCompatibility.html

  7. O2O、C2C、B2B、B2C

    一.O2O.C2C.B2B.B2C的区别在哪里? O2O是Online to offline 分为四种运营模式 1.Online to offline 是线上交易到线下消费体验 2.Offline t ...

  8. idea中的maven模块变成灰色的可能原因

    在使用idea的过程中,遇到其中一个maven模块变成灰色,如下所示: 造成这个的原因可能是忽略了maven模块,可以尝试如下解决方法:在idea中maven的setting中找到ignored fi ...

  9. mysql function 中使用游标

    create function p_t1(tid varchar(20))returns varchar(200)begin declare tmpName varchar(50) default ' ...

  10. Android [VP]视频播放器播放本地视频时收到短信/彩信,需要界面提示 M

    前言          欢迎大家我分享和推荐好用的代码段~~ 声明          欢迎转载,但请保留文章原始出处:          CSDN:http://www.csdn.net        ...