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. 卡尔曼滤波算法--核心公式推导导论 - ZZ

    卡尔曼滤波算法--核心公式推导导论 10 个月前 写在最前面:这是我第一篇专栏文章,感谢知乎提供这么一个平台,让自己能和大家分享知识.本人会不定期的开始更新文章,文章的内容应该集中在汽车动力学控制,整 ...

  2. xgboost入门与实战

    xgboost入门与实战(实战调参篇) https://blog.csdn.net/sb19931201/article/details/52577592 前言 前面几篇博文都在学习原理知识,是时候上 ...

  3. mysql CAPI 接口 读取中文乱码的解决方案(转)

      最近的yymysqlsdk的开源项目里,对中文的支持不到位,因此用了1.5天的时间,对中文处理的各个情况进行了分析.     1.首先确认你的MySQL配置文件,my.ini (只针对window ...

  4. URL重写2.1.mis

    概观 IIS URL重写2.1使Web管理员能够创建强大的规则来实现更容易让用户记住的网址,并使搜索引擎更容易找到.通过使用规则模板,重写映射,.NET提供程序和集成到IIS管理器中的其他功能,Web ...

  5. 【Python】torrentParser1.04 增加获得磁力链URI功能

    代码: #------------------------------------------------------------------------------------ # torrentP ...

  6. oracle 复制表结构表数据

    create table Uc_t_Department3 as (select * from Uc_t_Department where 1=2);insert into Uc_t_Departme ...

  7. iOS开发 - Content hugging priority & Content compression resistance priority

    1. 什么是Content hugging priority 你可以把它想象成一根放在视图上的橡皮筋. 这根橡皮筋会组织视图超过它本身的固有大小(intrinsic content size). 它存 ...

  8. 如何在onCreate方法中获取视图的宽度和高度

    你可以通过视图的getWidth()和getHeight()来获取视图的宽度和高度. 但是,可能会让你失望的是,如果你直接在onCreate方法内调用这两个函数,你会的到0. 为什么呢? 这是因为,当 ...

  9. 使用gradle的application插件进行Spring-boot项目打包

    1:在build.gradle中增加以下配置 fat jar并不总是一个合适的选择,比如需要依赖跟jar分离,使用gradle的application插件就可以做到. 在GradleTest项目中,b ...

  10. oneinstack一键部署linux生产环境那点事(ubuntu)

    http://oneinstack.com/install/ (1)将oneinstack-full.tar.gz最新版安装文件上传至/usr/local/下 (2)解压tar xzvf oneins ...