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 ...
随机推荐
- 201621123031 《Java程序设计》第10周学习总结
作业10-异常 1.本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结异常相关内容. 1.捕捉异常 Java中的异常捕获结构由try.catch和finally三个部分组成.其中try语句 ...
- 多线程socket UDP收发数据
多线程socket收发数据 from threading import Thread from socket import * def sendData(): while True: sendInfo ...
- appcompat v21: 让 Android 5.0 前的设备支持 Material Design
1. 十大Material Design开源项目 2. appcompat v21: 让 Android 5.0 前的设备支持 Material Design 主题 AppCompat已经支持最新的调 ...
- 小草手把手教你LabVIEW串口仪器控制—安装使用仪器现有驱动
声明:很多仪器是没有驱动的.所以,具体问题具体分析.另外声明:所谓的驱动,也就是封装好的底层的串口通信程序,也是程序而已,只不过别人帮你做成了子 VI,让自己容易用.所以:不要弄混淆了概念.国外的很多 ...
- 识别图片中文字(百度AI)
这个是百度官方的文档 https://ai.baidu.com/docs#/OCR-API/top 通用的文字识别,如果是其他的含生僻字/含位置信息的版本,请参考官方的文档,只 ...
- VS Code 常用命令记录
1. 创建解决方案 例:dotnet new sln -o HelloWorld.Solutions 其中 -o 表示输出文件夹 2.创建类库.web.mvc.webapi等项目 例:dotnet n ...
- c# BinaryWriter 和 BinaryReader
string path = @"C:\Users\Administrator\Desktop\1.txt"; using (FileStream ws = new FileStre ...
- java基础复习(1)
用记事本写java文件 打开记事本,编写java文件,需要注意文件名与类名要相同 注意文件的后缀名(也叫拓展名)改为.java java对大小写是敏感的 public class nihao{\ pu ...
- 非PE病毒介绍
1.宏病毒 1.1 介绍 本文中的宏特制office系列办公软件中的宏,Microsoft Office中对宏的定义为"宏就是能够组织在一起的,可以作为一个独立命令来执行的一系列Word 命 ...
- maven入门(1-1)maven是什么?
Maven是一个项目管理工具,它包含了 一个项目对象模型 (Project Object Model), 一组标准集合, 一个项目生命周期(Project Lifecycle), 一个依赖管理系统(D ...