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 ...
随机推荐
- 【bzoj1059】矩形游戏
题意 小Q是一个非常聪明的孩子,除了国际象棋,他还很喜欢玩一个电脑益智游戏--矩阵游戏.矩阵游戏在一个N*N黑白方阵进行(如同国际象棋一般,只是颜色是随意的).每次可以对该矩阵进行两种操作:行交换操作 ...
- AOP 之 6.1 AOP基础(拾陆)
6.1.1 AOP是什么 考虑这样一个问题:需要对系统中的某些业务做日志记录,比如支付系统中的支付业务需要记录支付相关日志,对于支付系统可能相当复杂,比如可能有自己的支付系统,也可能引入第三方支付平 ...
- 转 http://www.5icool.org/a/201106/a654.html CSS开发中常用的公用样式
overflow:hidden 隐藏溢出 一.自己总结的公用样式解析 html, body, div, p, ul, li, dl, dt, dd, h1, h2, h3, h4, h5, h6, f ...
- 张艾迪(创始人):拥抱单身与自由的Eidyzhang
拥抱单身与自由(Single+Freedom) 拥抱伟大的梦想与理想.年轻一代的张扬与自信 拥抱AOOOiA.Global.224C的一切是我对这个世界的态度 +AOOOiA.Global.224C创 ...
- EasyUI combotree 使用技巧
$('#areaName').combotree({ url: '../Ajax/Common.ashx?Method=GetCombotreeData', multiple: true, check ...
- oracle个人总结
oracle优化原则 1:insert 插入 (1):insert into /*+ append */ NOLOGGING 2: select 查询 (1):/*+ full(v) */ 全表查询 ...
- 使用2个MR计算
转载:http://www.cnblogs.com/sharpxiajun/p/5205496.html 最近做了一个小的mapreduce程序,主要目的是计算环比值最高的前5名,本来打算使用spar ...
- Spring学习(一)——Spring中的依赖注入简介【转】
[前面的话] Spring对我太重要了,做个关于web相关的项目都要使用Spring,每次去看Spring相关的知识,总是感觉一知半解,没有很好的系统去学习一下,现在抽点时间学习一下Spring. ...
- HTML 中 META的作用
说明: meta是用来在HTML文档中模拟HTTP协议的响应头报文.meta 标签用于网页的<head>与</head>中,meta 标签的用处很多.meta 的属性有两种:n ...
- S1:new操作符
function Shape(type){ this.type = type || "rect"; this.calc = function(){ return "cal ...