Uva 11044 Searching for Nessy

本文探讨了一种使用声纳束探测尼斯湖水怪的方法。针对一个n行m列的网格地图,目标是最小化声纳数量,确保每个位置都能被至少一个3x3范围内的声纳覆盖。

  Searching for Nessy 

The Loch Ness Monsteris a mysterious and unidentified animal said to inhabit Loch Ness,  
a large deep freshwater loch near the city of Inverness in northern Scotland. Nessie is usually categorized as a type of lake monster.
 
http://en.wikipedia.org/wiki/Loch_Ness_Monster


In July 2003, the BBC reported an extensive investigation of Loch Ness by a BBC team, using 600 separate sonar beams, found no trace of any ¨sea monster¨ (i.e., any large animal, known or unknown) in the loch. The BBC team concluded that Nessie does not exist. Now we want to repeat the experiment.


Given a grid of n rows and m columns representing the loch, 6$ \le$nm$ \le$10000, find the minimum number s of sonar beams you must put in the square such that we can control every position in the grid, with the following conditions:

  • one sonar occupies one position in the grid; the sonar beam controls its own cell and the contiguous cells;
  • the border cells do not need to be controlled, because Nessy cannot hide there (she is too big).

For example,


$\textstyle \parbox{.5\textwidth}{\begin{center}\mbox{}\epsfbox{p11044.eps}\end{center}}$$\textstyle \parbox{.49\textwidth}{\begin{center}\mbox{}\epsfbox{p11044a.eps}\end{center}}$

\epsfbox{p11044b.eps}

where X represents a sonar, and the shaded cells are controlled by their sonar beams; the last figure gives us a solution.

Input

The first line of the input contains an integer, t, indicating the number of test cases. For each test case, there is a line with two numbers separated by blanks, 6$ \le$nm$ \le$10000, that is, the size of the grid (n rows and m columns).

Output

For each test case, the output should consist of one line showing the minimum number of sonars that verifies the conditions above.

Sample Input

 
3
6 6
7 7
9 13

Sample Output

 
4
4
12

题目大意:

问n*m的地图最多放多少个3*3的矩形。

题目解析:

水题,简单输出(m/3)*(n/3)就好了

#include<iostream>
#include<math.h>

using namespace std;

int main() {
	int t;
	int m,n;
	while(cin >> t) {
		while(t--) {
			cin>>m>>n;
			cout<<(m/3)*(n/3)<<endl;
		}	
	}
	return 0;
}



### MobileNetV3 模型介绍 MobileNetV3 是一种轻量级深度学习模型,专为移动设备和嵌入式设备设计,以实现高效的图像识别任务。它通过应用平台感知的神经架构搜索(NAS)和 NetAdapt 算法来优化网络结构,并结合了新的改进技术,如 Squeeze-and-Excite 模块和 Hard-Swish 激活函数,从而在保持低计算成本的同时提高了模型性能。 该模型分为两个版本:**MobileNetV3-Large** 和 **MobileNetV3-Small**,分别适用于高资源需求和低资源需求的场景[^1]。这两个版本在 ImageNet 数据集上的表现优于前代模型 MobileNetV2,尽管实际部署中 MobileNetV2 仍然较为常见[^2]。 #### 主要特性 - **轻量化设计**:采用深度可分离卷积(Depthwise Separable Convolution),大幅减少参数数量和计算量。 - **Squeeze-and-Excite 模块**:引入通道注意力机制,提升特征表达能力。 - **Hard-Swish 激活函数**:相比传统 ReLU,提供更平滑的非线性变换,有助于提高模型精度。 - **平台感知 NAS 搜索**:利用自动化网络搜索技术优化模型结构,使其在特定硬件平台上达到最佳性能。 ### 应用指南 #### 图像分类 MobileNetV3 可用于图像分类任务,尤其适合在计算资源受限的设备上运行。以下是一个使用 TensorFlow/Keras 加载预训练 MobileNetV3-Small 模型并进行图像分类的示例: ```python import tensorflow as tf from tensorflow.keras.applications.mobilenet_v3 import MobileNetV3Small, preprocess_input, decode_predictions from tensorflow.keras.preprocessing import image import numpy as np # 加载预训练的小型模型 model = MobileNetV3Small(weights='imagenet') # 加载并预处理输入图像 img_path = 'path_to_your_image.jpg' img = image.load_img(img_path, target_size=(224, 224)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) # 进行预测 preds = model.predict(x) print('Predicted:', decode_predictions(preds, top=3)[0]) ``` #### 目标检测与语义分割 MobileNetV3 也可作为特征提取器应用于目标检测(如 SSD、YOLO)或语义分割(如 DeepLab)等任务中。通常会将 MobileNetV3 的主干网络替换原有特征提取模块,以获得更高的推理效率。 #### 部署建议 - 在移动端部署时,推荐使用 **MobileNetV3-Small** 版本,以节省内存和计算资源。 - 若需更高精度且对资源要求不敏感,可选择 **MobileNetV3-Large**。 - 利用 TensorFlow Lite 或 ONNX Runtime 等工具进行模型压缩和加速,以便更好地适应边缘设备。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值