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的更多相关文章

  1. HDU 2052 Picture

    http://acm.hdu.edu.cn/showproblem.php?pid=2052 Problem Description Give you the width and height of ...

  2. hdu 2052 Picture(java)

    问题: 開始直接用输入的数作为宽和高,但实际上要多出两行边框,所以要加一个2. 还有题目要求最后要输出一个空行没有注意到. Picture Time Limit: 1000/1000 MS (Java ...

  3. HDU——PKU题目分类

    HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...

  4. [转] HDU 题目分类

    转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...

  5. HDU ACM 题目分类

    模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...

  6. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  7. poj和hdu部分基础算法分类及难度排序

    最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...

  8. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  9. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

随机推荐

  1. 根据List中对象的某一属性进行排序

    不多说,直接看代码: package test; import java.util.ArrayList; import java.util.Collections; import java.util. ...

  2. python 练习 8

    #!/usr/bin/python # -*- coding: utf-8 -*- def ntom(x,size,mod): t=[0]*(size) j=0 while x and j<si ...

  3. Ubuntu安装nodeJS

    安装环境 ubuntu12.04 64bit nodejs-v0.8.14.tar.gz Node.js是一个基于google v8+javascript的服务端编程框架.但是Node.js又不是js ...

  4. 30 个有用的 HTML5 和 CSS3 表单设计

    基本上表单是任何一个网站都必须要用到的元素,本文介绍的这 30 个设计方案供你参考,这些方案如果要单独下载完整可运行的文件则需要支付2-5美元的费用. 1. Fresh Forms 2. Pretty ...

  5. 关于JVM的类型和模式

    原文出处: 摆渡者 引言 曾几何时,我也敲打过无数次这样的命令: 然而之前的我都只关心过版本号,也就是第一行的内容.今天,我们就来看看第3行输出的内容:JVM的类型和工作模式. 其实说Server和C ...

  6. hdu 4405Aeroplane chess(概率DP)

    Aeroplane chess Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  7. Eclipse添加jsp页面后引入java指令报错解决方法

    新建jsp页面老提示: Multiple annotations found at this line: - The superclass "javax.servlet.http.HttpS ...

  8. hadoop主节点(NameNode)备份策略以及恢复方法

    link:http://jiajun.iteye.com/blog/809125 一.dits和fsimage 首先要提到两个文件edits和fsimage,下面来说说他们是做什么的. 集群中的名称节 ...

  9. [转]C#中的Monitor类

    object obj=new object(); Monitor在锁对象obj上会维持两个线程队列R和W以及一个引用T : (1) T是对当前获得了obj锁的线程的引用(设此线程为CurrThread ...

  10. 如何对ConnectionString进行加密解码?

    这个就不说了就是一个类 public static class EncryptionConfig { /* 加密配置节点 * Response.Write(EncryptionConfig.Encry ...