hdu 2052
PS:竟然一次AC....惊喜...注意每个实例后跟一个空行..
学到一个快速清空数组的用法...memst函数. memst(void *s,char a,sizeof n) 把 s里面的前n个变成a
顺便在后面贴上一个大神的ac代码
代码:
#include "stdio.h"
void darm(int n,int m);
void spa(int n);
int main(){
int n,m;
while(~scanf("%d%d",&n,&m)){
darm(n,m);
puts("");
}
return 0;
}
void darm(int n,int m){
int i;
printf("+");
for(i=0;i<n;i++) printf("-");
printf("+\n");
for(i=0;i<m;i++){
printf("|");
spa(n);
printf("|\n");
}
printf("+");
for(i=0;i<n;i++) printf("-");
printf("+\n");
}
void spa(int n){
int i;
for(i=0;i<n;i++)
printf(" ");
}
大神代码:
# include <stdio.h>
# include <string.h>
# define REP(a,b) for(a = 0 ; a < b ; a++)
char gp[100][100] ;
int main ()
{
int i, n, m ;
while (~scanf ("%d%d", &n, &m))
{
memset(gp, ' ', sizeof(gp)) ;
REP(i,m+2) gp[i][0] = gp[i][n+1] = '|', gp[i][n+2] = '\0' ;
REP(i,n+2) gp[0][i] = gp[m+1][i] = '-' ;
gp[0][0] = gp[0][n+1] = gp[m+1][0] = gp[m+1][n+1] = '+' ;
REP(i,m+2) puts (gp[i]) ;
puts ("") ;
}
return 0 ;
}
hdu 2052的更多相关文章
- HDU 2052 Picture
http://acm.hdu.edu.cn/showproblem.php?pid=2052 Problem Description Give you the width and height of ...
- hdu 2052 Picture(java)
问题: 開始直接用输入的数作为宽和高,但实际上要多出两行边框,所以要加一个2. 还有题目要求最后要输出一个空行没有注意到. Picture Time Limit: 1000/1000 MS (Java ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- [转] HDU 题目分类
转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...
- HDU ACM 题目分类
模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
- poj和hdu部分基础算法分类及难度排序
最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
随机推荐
- JQUERY学习(贰)
一.操作一组jQuery对象 1.遍历 $("").each(fun); 2.求长度:length size() 3.获得某一个jQuery对象 $("") ...
- Disney English
项目大体流程是做几个页面的模板,然后后台用html改成phtml 但是后期连模板都要改掉,很多都无法考虑到复用 css很混乱,js已经忘记了
- SSH基础(2)
linux下配置 ssh运行的参数详解:
- DataTable常用操作
添加列和行的三种方法(转载) 原文地址:http://www.cnblogs.com/jRoger/articles/1887581.html DataTable tblDatas =new Data ...
- PHP慕课网教程
PHP入门篇:http://www.imooc.com/learn/54 3-2 如何定义变量 ”var_dump”函数可以将我们的变量的数据类型(后面小节会做介绍)显示出来. <?php $v ...
- SQL的常用语句
select * from g_members where id between '16' and '31' order by id desc 倒序排列 select * from g_members ...
- 20145236 《Java程序设计》第4周学习总结
20145236 <Java程序设计>第4周学习总结 教材学习内容总结 第六章 继承与多态 一.继承 •继承是java面向对象编程技术的一块基石,因为它允许创建分等级层次的类.继承可以理解 ...
- Java DSL简介(收集整理)
一.领域特定语言(DSL) 领域特定语言(DSL)通常被定义为一种特别针对某类特殊问题的计算机语言,它不打算解决其领域外的问题.对于DSL的正式研究已经持续很多年,直 到最近,在程序员试图采用最易读并 ...
- 平衡查找树之B树
转自:http://www.cnblogs.com/yangecnu/p/Introduce-B-Tree-and-B-Plus-Tree.html 定义 B 树可以看作是对2-3查找树的一种扩展,即 ...
- Storm(4) - Distributed Remote Procedure Calls
Using DRPC to complete the required processing 1. Create a new branch of your source using the follo ...