题意:给定一个n*m的方阵,第i行第j列的高度为a[i][j],问除了下底面之外其余五面的总表面积

n<=50,0<=a[i][j]<=1000

思路:队友写的,抱大腿

考虑当前方格比周围四格高多少即可

 #include<cstdio>
#include<cstring>
using namespace std;
#define LL long long
const int maxn=;
int a[maxn][maxn];
int dx[]={,,-,};
int dy[]={,,,-};
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
int n,m;
memset(a,,sizeof(a));
scanf("%d%d",&n,&m);
for(int i=;i<=n;i++)
for(int j=;j<=m;j++)
scanf("%d",&a[i][j]);
int sum=;
for(int i=;i<=n;i++)
for(int j=;j<=m;j++)
{
if(!a[i][j])
continue;
sum++;
for(int k=;k<;k++)
{
int x=dx[k]+i;
int y=dy[k]+j;
if(a[x][y]<a[i][j])
sum+=a[i][j]-a[x][y];
}
}
printf("%d\n",sum);
}
}

【HDOJ5538】House Building(计算几何)的更多相关文章

  1. POJ 2031 Building a Space Station (计算几何+最小生成树)

    题目: Description You are a member of the space station engineering team, and are assigned a task in t ...

  2. POJ - 2031 Building a Space Station(计算几何+最小生成树)

    http://poj.org/problem?id=2031 题意 给出三维坐标系下的n个球体,求把它们联通的最小代价. 分析 最小生成树加上一点计算几何.建图,若两球体原本有接触,则边权为0:否则边 ...

  3. HDU5033 building 单调栈+计算几何

    正解:单调栈 解题报告: 哇生气辽QAQ本来打了半天feel good都快调出来了然后说换题了QAQ(所以可能那题的代码会过一阵子再放上来了QAQ 不过还是大爆手速打了一通拿到首杀了嘻嘻 美滋滋辽 然 ...

  4. HDU 4667 Building Fence(2013多校7 1002题 计算几何,凸包,圆和三角形)

    Building Fence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)To ...

  5. POJ 2031 Building a Space Station【最小生成树+简单计算几何】

    You are a member of the space station engineering team, and are assigned a task in the construction ...

  6. [hdu4667]Building Fence 计算几何 瞎瘠薄搞

    大致题意: 给出n个圆和m个三角形,求最小的的,能将所有图形覆盖的图形的周长. 正解为求所有三角形顶点与圆的切点以及圆和圆的切点构造凸包,再求路径. 因为要求结果误差<=1e-3 所以 我们可以 ...

  7. 【计算几何】【凸包】bzoj1670 [Usaco2006 Oct]Building the Moat护城河的挖掘

    #include<cstdio> #include<cmath> #include<algorithm> using namespace std; #define ...

  8. HDU 4667 Building Fence 计算几何 凸包+圆

    1.三角形的所有端点 2.过所有三角形的端点对所有圆做切线,得到所有切点. 3.做任意两圆的外公切线,得到所有切点. 对上述所有点求凸包,标记每个点是三角形上的点还是某个圆上的点. 求完凸包后,因为所 ...

  9. hdu 4667 Building Fence < 计算几何模板>

    //大白p263 #include <cmath> #include <cstdio> #include <cstring> #include <string ...

随机推荐

  1. (76)zabbix_agentd.conf配置文件详解

    ############ GENERAL PARAMETERS ################# ### Option: PidFile# Name of PID file.# Agent PID文 ...

  2. http 工作模式与模块

    目录 http 工作模式与模块 http 服务器应用 MPM工作模式 prefork worker event 进程角色 httpd功能特性 http 安装 centos6配置目录 http 2.2 ...

  3. 5-2 os模块

    导入os模块 import os res = os.listdir('D:\study') # 列出某个目录下的所有文件 os.remove('newuser.json') # 删除某个目录下的某个文 ...

  4. CentOS Linux release 7.6.1810全新安装 Zimbra 8.8.12邮箱

    1.1  基础环境配置 1.1.1  主机名配置 [root@mail ~]# hostnamectl --static set-hostname mail.example.com [root@mai ...

  5. HTML5/CSS3 第二章页面组件

    页面组件 1 元素的尺寸/边框/背景 1.1 css尺寸相关属性 height 高度 min-height 最小高度 max-height 最大高度 width 宽度 min-width 最小宽度 m ...

  6. tcl之变量-简单变量

  7. 684. Redundant Connection

    https://leetcode.com/problems/redundant-connection/description/ Use map to do Union Find. class Solu ...

  8. proc的妙用

    今天在在公司做网络驱动开发测试时,随机包出现收包计数停止的现象,当时怀疑是DMA rx buffer不足导致,想通过对比收发包正常和收发包不正常是DMA相关寄存器的情况. 后跟踪代码,若在收发包里面增 ...

  9. [jzoj5233]概率博弈(树形DP)

    Description 小A和小B在玩游戏.这个游戏是这样的: 有一棵

  10. Leetcode 515. 在每个树行中找最大值

    题目链接 https://leetcode-cn.com/problems/find-largest-value-in-each-tree-row/description/ 题目描述 您需要在二叉树的 ...