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. PHP 7中利用OpenSSL代替Mcrypt加解密的方法详解

    php7.1发布后新特性吸引了不少PHPer,大家都在讨论新特性带来的好处与便利.但是从php7.0 升级到 php7.1 废弃(过时)了一个在过去普遍应用的扩展(mcrypt扩展).官方提供了相应的 ...

  2. Java复习2-对象与类

    回顾基础知识过程中遇到的感觉需要记录一下的知识点. 封装 我们设计的class应当尽可能的高内聚,体现为封装的程度.一个class的属性应该只能自己修改,其他class都只是与本class沟通,而不应 ...

  3. T 分布(近似标准正态分布)

    1.1      定义 定义:假设X服从标准正态分布N(0,1),Y服从卡方分布,那么的分布称为自由度为n的t分布,记为. T分布密度函数其中,Gam(x)为伽马函数. 可用于两组独立计量资料的假设检 ...

  4. 【Python】无须numpy,利用map函数与zip(*)函数对数组转置(转)

    http://blog.csdn.net/yongh701/article/details/50283689 在Python的numpy中,对类似array=[[1,2,3],[4,5,6],[7,8 ...

  5. Centos6.4下安装mysql5.6.10

    今天下午捣腾安装mysql和apache.从网上下载mysql5.6.10,http://ishare.iask.sina.com.cn/f/36050990.html,解压后发现没有configur ...

  6. Kafka:ZK+Kafka+Spark Streaming集群环境搭建(十七)Elasticsearch-6.2.2集群安装,组件安装

    1.集群安装es ES内部索引原理: <时间序列数据库的秘密(1)—— 介绍> <时间序列数据库的秘密 (2)——索引> <时间序列数据库的秘密(3)——加载和分布式计算 ...

  7. java多线程之间的顺序问题

    java 多线程: 这样写有问题的:这样写可以的: package com.test; import java.util.concurrent.CountDownLatch; import java. ...

  8. Authentication and Authorization in ASP.NET Web API

      You've created a web API, but now you want to control access to it. In this series of articles, we ...

  9. ListView显示不同布局

    在使用不同布局的时候,getItemViewType和getViewType不能少,通常是不用这两个函数的重载的 listView.setAdapter(new BaseAdapter() { @Ov ...

  10. Solidworks直接打开SWB文件报错怎么办