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

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. 最小生成树 prime poj1258

    题意:给你一个矩阵M[i][j]表示i到j的距离 求最小生成树 思路:裸最小生成树 prime就可以了 最小生成树专题 AC代码: #include "iostream" #inc ...

  2. Task异步编程

    Task异步编程中,可以实现在等待耗时任务的同时,执行不依赖于该耗时任务结果的其他同步任务,提高效率. 1.Task异步编程方法签名及返回值: a) 签名有async 修饰符 b) 方法名以 Asyn ...

  3. 【安装mysql】windows安装压缩版mysql5.7.15

      160915.1459 综述 中午安装成功,但是启动失败,很可能是压缩包有问题(从别人拷的),解决了近一个小时,没搞定,于是换条方案,重新去官网下载压缩包,这次看准了windows架构,且64-b ...

  4. 不需要sql进行计算数据的平均值、最大值、最小值、和

    介绍下SqlServer.前端js.后台C#三个阶段对均值.最大值.最小值.和计算int[] jisuan = {0, 1, 3, 5, 7,8 }; List<int> jisuan2 ...

  5. 线上应用bug跟踪查找-友盟统计

    线上的应用只要用心点点都能发现些bug,连微信,QQ也不列外.但是bug中最严重的算是闪退了,这导致了用户直接不能使用我们的app. 我们公司是特别注重用户反馈和体验的,我们会定期打电话咨询用户的使用 ...

  6. canvas初探1

    刚申请的博客,当然这也是第一篇.对于canvas也是刚开始着手进行学习,有哪些不对的地方,还望看到本篇博文的朋友指正. 1.canvas的历史 首先,它是HTML5的一个标签. 它是为了客户端矢量图形 ...

  7. C# Winform中如何让PictureBox的背景透明

    最近做winform程序,其中有个需求:有两个PictureBox完全重叠,上面一个需要透明,不能遮挡下面的,以为设置上面的BackColor为透明色就可以了,结果不行,上网搜了一下,发现对于我这种需 ...

  8. 基于Deep Learning 的视频识别方法概览

    深度学习在最近十来年特别火,几乎是带动AI浪潮的最大贡献者.互联网视频在最近几年也特别火,短视频.视频直播等各种新型UGC模式牢牢抓住了用户的消费心里,成为互联网吸金的又一利器.当这两个火碰在一起,会 ...

  9. 你必须知道的指针基础-4.sizeof计算数组长度与strcpy的安全性问题

    一.使用sizeof计算数组长度 1.1 sizeof的基本使用 如果在作用域内,变量以数组形式声明,则可以使用sizeof求数组大小,下面一段代码展示了如何使用sizeof: ,,,,,}; int ...

  10. Spring学习记录(四)---bean之间的关系:继承、依赖

         继承 这里说的继承和java的继承是不一样的,不是父类子类.但思想很相似,是父bean和子bean 1.父bean是一个实例时.它本身是一个完整的bean 2.父bean是模板,抽象bean ...