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 ...
随机推荐
- 【作业】HansBug的前三次OO作业分析与小结
OO课程目前已经进行了三次的作业,容我在本文中做一点微小的工作. 第一次作业 第一次作业由于难度不大,所以笔者程序实际上写的也比较随意一些.(点击就送指导书~) 类图 程序的大致结构如下: 代码分析 ...
- 开发者的如何优雅的使用OSX
Mac对于IT开发者来说是最好的开发工具,没有之一. 但是对于大部分人来说,第一个接触的PC操作系统都是Windows系统,此文将带大家优雅的快速学习和使用Mac的OSX系统. 1. 从键盘说起 Ma ...
- Python扩展模块——selenium的使用(定位、下载文件等)
想全面的使用selenium可以下载<selenium 2自动化测试实战-基于Python语言>PDF的电子书看看 我使用到了简单的浏览器操作,下载文件等功能... 推荐使用firefox ...
- maven 每次update后影响接口实现类的问题
遇到maven每次update后,就会更改eclipse中java Compiler中的jdk compliance版本 <plugin> <groupId>org.apach ...
- Angular 学习笔记 ( CDK - Accessibility )
@angular/ckd 是 ng 对于 ui 组建的基础架构. 是由 material 团队开发与维护的, 之所以会有 cdk 看样子是因为在开发 material 的时候随便抽象一个层次出来给大家 ...
- MySql入门(2-2)创建数据库
mysql -u root -p; show databases; create database apigateway; use apigateway; show tables;
- 无用代码清除tip
测试提了个bug过来,说是有个ajax请求报404了. 我一看,后台代码被人删了,问了同事,因为实现机制变了,是应该删,但删多了. 把service和controller都恢复后,一个接口中除了我那个 ...
- UIView圆角设置
对于UIview的圆角设置最简单的就是layer的两个属性分别是cornerRadius和masksToBounds,但是对于设置其中某一个角为圆角的时候需要使用贝塞尔曲线 UIView *aView ...
- Android:ImageView控件显示图片
1)android显示图片可以使用imageView来呈现,而且也可以通过ImageButton来实现给button添加图片. 2)在创建一个ImageView后,显示图片绑定元素是:android: ...
- [翻译] softmax和softmax_cross_entropy_with_logits的区别
翻译自:https://stackoverflow.com/questions/34240703/whats-the-difference-between-softmax-and-softmax-cr ...