题目本身属于简单题,但是注意在输出的时候,题目很变态的对格式做了很多要求:

1.输入的N与下面的block有一个空行

2.每次输出与下一个输入的block有一个空行

3.但是特别注意,当是最后一个输出时不需要输出空行

见代码:

#include <stdio.h>
#include <string.h> void invert(char *a)
{
int l=strlen(a);
for(int i=,j=l-;i<j;i++,j--)
{
char t;
t=a[i];
a[i]=a[j];
a[j]=t;
}
} char * sum(char *a,char *b) //length of a is biger than b
{
int la=strlen(a),lb=strlen(b);
int c=,i; for(i=;i<lb;i++)
{
int t=a[i]+b[i]-''-''+c;
if(t/!=)
{
c=t/;
t=t%;
a[i]=t+'';
}
else
{
a[i]=t+'';
c=;
}
} if(c!=)
{
for(i=lb;i<la;i++)
{
int t=a[i]+c-'';
if(t/!=)
{
c=t/;
t=t%;
a[i]=t+'';
}
else
{
a[i]=t+'';
c=;
break;
}
}
if(c!=)
{
a[i++]=c+'';
a[i]='\0';
}
} return a;
} int main()
{
int N;
scanf("%d",&N); while(N--)
{
getchar();
char t[],result[];
int i=;
scanf("%s",t);
if(!strcmp(t,""))
{
printf("0\n");
continue;
}
else
{
invert(t);
strcpy(result,t);
} while(scanf("%s",t)!=EOF&&strcmp(t,""))
{
int lr=strlen(result),lt=strlen(t);
invert(t);
if(lr>=lt)
strcpy(result,sum(result,t));
else
strcpy(result,sum(t,result));
}
invert(result);
printf("%s\n",result);
if(N>) printf("\n");
} return ;
}

ZOJ Problem Set - 1292 Integer Inquiry的更多相关文章

  1. Problem D: Integer Inquiry

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

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

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

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

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

  4. hdu1047 Integer Inquiry

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

  5. hdu 1047 Integer Inquiry

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

  6. Poj 1503 Integer Inquiry

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

  7. hdoj 1047 Integer Inquiry

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

  8. ZOJ Problem Set - 3593 拓展欧几里得 数学

    ZOJ Problem Set - 3593 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3593 One Person ...

  9. (大数 string) Integer Inquiry hdu1047

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

随机推荐

  1. bat获取所有的参数

    bat默认只能获取到1-9个参数,分别用%1 %2 ... %9引用,如果传给bat的参数大于9个,就必须用shift. 工作需要,要写个bat脚本,获取所有的参数,再将所有的参数传给Java,代码如 ...

  2. ActionMapping

    在Struts中,ActionServlet只是任务的分派者,它依请求分配任务给其它的对象来执行,而分配的依据是请求的URI以及struts-config.xml的<action-mapping ...

  3. HDU(1285)—确定比赛名次

    /*最近都在复习期末了...好久没做题,都快没智商了*/   有N个比赛队(1<=N<=500),编号依次为1,2,3,....,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后 ...

  4. bfs判断连通图(无向)

    在图论中,连通图基于连通的概念.在一个无向图 G 中,若从顶点vi到顶点vj有路径相连(当然从vj到vi也一定有路径),则称vi和vj是连通的.如果 G 是有向图,那么连接vi和vj的路径中所有的边都 ...

  5. 仿JQ基础架构,可扩展。

    (function(win,doc,fn){     var events = [];//拷贝核心方法    var publicEvent = ["extend","f ...

  6. 非常棒的Android对话框效果

    FlycoDialog_Master http://www.see-source.com/androidwidget/detail.html?wid=488 带有各种动画效果的弹出对话框控件.你也可以 ...

  7. composer安装

    1.首先到php.net下载对应版本的php,zip版本即可,注意windows需要vc11运行库支持 2.配置path路径添加对php解压目录的引用 3.将php.ini-development  ...

  8. windows上面捕获声卡数据

    转自:http://shanewfx.github.io/blog/2013/08/14/caprure-audio-on-windows/ 前一段时间接到一个任务,需要采集到声卡的输出信号,以便与麦 ...

  9. PHP中Strict Standards错误解决方法二

    在PHP5.3.3 中安装wordpress 3.0.1 ,在安装时出现错误:Strict Standards: PHP Strict Standards: Declaration of Walker ...

  10. ASP.NET安全

    ASP.NET 安全 概述 安全在web领域是一个永远都不会过时的话题,今天我们就来看一看一些在开发ASP.NET MVC应用程序时一些值得我们注意的安全问题.本篇主要包括以下几个内容 : 认证 授权 ...