hdu 5538(水)
First line of each test case is a line with two integers n,m.
The n lines
that follow describe the array of Nyanko-san's blueprint, the i-th
of these lines has m integers ci,1,ci,2,...,ci,m,
separated by a single space.
1≤T≤50
1≤n,m≤50
0≤ci,j≤1000
3 3
1 0 0
3 1 2
1 1 0
3 3
1 0 1
0 0 0
1 0 1
20
题意:给你n*m的地方,每个点有一个数组x代表这的高度,求这个立体的表面积
思路:求出顶部面积,在计算每个柱子比周围柱子高多少即可
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <vector>
#include <algorithm>
#include <functional>
typedef long long ll;
using namespace std; int tmap[55][55];
int dir[][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; int main()
{
int T,n,m;
scanf("%d",&T);
while(T--)
{
ll ans = 0;
scanf("%d%d",&n,&m);
memset(tmap,0,sizeof(tmap));
for(int i = 1; i <= n; i ++)
for(int j = 1; j <= m; j++)
{
scanf("%d",&tmap[i][j]);
if(tmap[i][j] > 0)
ans ++;
}
for(int i = 1; i <= n; i ++)
for(int j = 1; j <= m; j++)
{
for(int k = 0;k < 4;k++)
{
int tx = i+dir[k][0];
int ty = j+dir[k][1];
if(tmap[i][j] > tmap[tx][ty])
ans += tmap[i][j] - tmap[tx][ty];
}
}
printf("%lld\n",ans);
}
return 0;
}
hdu 5538(水)的更多相关文章
- HDU-1042-N!(Java大法好 && HDU大数水题)
N! Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Subm ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- hdu 5538 House Building(长春现场赛——水题)
题目链接:acm.hdu.edu.cn/showproblem.php?pid=5538 House Building Time Limit: 2000/1000 MS (Java/Others) ...
- HDU 5538 (水不水?)
House Building Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) ...
- HDU 5538/ 2015长春区域 L.House Building 水题
题意:求给出图的表面积,不包括底面 #include<bits/stdc++.h> using namespace std ; typedef long long ll; #define ...
- hdu 4464 水
http://acm.hdu.edu.cn/showproblem.php?pid=4464 现场赛总会有水题,这就是最水的一道,预计也就是能当高校的上机题,保研用,呵呵~~~ #include &l ...
- HDU 5538 House Building(模拟——思维)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5538 Problem Description Have you ever played the vi ...
- HDU 5391 水题。
E - 5 Time Limit:1500MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- hdu 1544 水题
水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...
随机推荐
- Scrum 冲刺 第五日
目录 要求 项目链接 燃尽图 问题 今日任务 明日计划 成员贡献量 要求 各个成员今日完成的任务(如果完成的任务为开发或测试任务,需给出对应的Github代码签入记录截图:如果完成的任务为调研任务,需 ...
- PostMan 调用WCF Rest服务
问题描述: 现在有已有的WCF服务,但是ajax是不能请求到这个服务的: 需要把WCF转成WCF REST 的风格. 以下是从WCF转 WCF REST的步骤 1.首先在接口定义的地方加上 请求 We ...
- nyoj 对决
对决 时间限制:1000 ms | 内存限制:65535 KB 难度:0 描述 Topcoder 招进来了 n 个新同学,Yougth计划把这个n个同学分成两组,要求每组中每个人必须跟另一组中 ...
- sublime安装 和 插件安装
先从官网下载sublime https://www.sublimetext.com/3 安装完毕后 快捷键ctrl+` 或者View->Show Console,输入如下代码(sublime ...
- js 从一个函数中传递值到另一个函数
一个函数的调用大家都会用 我今天在调接口的时候突然发现需要引用个另一个函数中拿到的值 举个栗子 刚开始 我是这样调用的 alert弹出的是 hello world . 但是我a函数内部还有一个函数 画 ...
- js前端对后台数据的获取,如果是汉字则需要添上引号
js前端对后台数据的获取,如果是汉字则需要添上引号
- JavaScript 动态显示当前时间
代码如下: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <tit ...
- C# 使用 GDI+ 给图片添加文字,并使文字自适应矩形区域
需求 需求是要做一个编辑文字的页面.用户在网页端写文字,文字区域是个矩形框,用户可以通过下方的拖动条调节文字大小. 如下图: 提交数据的时候前端传文字区域的左上角和右下角定位给后台.因为前端的字体大小 ...
- WPF 自定义Calendar样式(日历样式,周六周日红色显示)
一.WPF日历控件基本样式 通过Blend获取到Calendar需要设置的三个样式CalendarStyle.CalendarButtonStyle.CalendarDayButtonStyle.Ca ...
- maven入门(8)maven的依赖管理
我们项目中用到的jar包可以通过依赖的方式引入,构建项目的时候从Maven仓库下载即可. 1. 依赖配置 依赖可以声明如下: <project> ... <dependenci ...