博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2021.3.15做题记录
阅读量:3973 次
发布时间:2019-05-24

本文共 509 字,大约阅读时间需要 1 分钟。

  1. 图片平滑器
class Solution {
public: vector
> imageSmoother(vector
>& M) {
int m = M.size(), n = M.front().size(); vector
> result(m, vector
(n)); for (int i = 0; i < m; ++i) { for (int j = 0; j < n; ++j) { int num = 0, sum = 0; for (int _i = max(0, i-1); _i <= min(m-1, i+1); ++_i) { for (int _j = max(0, j-1); _j <= min(n-1, j+1); ++_j) { sum += M[_i][_j]; ++num; } } result[i][j] = sum / num; } } return result; }};

转载地址:http://bbmki.baihongyu.com/

你可能感兴趣的文章
misc_register和register_ch…
查看>>
platform设备添加流程(转载)
查看>>
platform设备添加流程(转载)
查看>>
GCC编译关键字“__attribute_…
查看>>
GCC编译关键字“__attribute_…
查看>>
Linux对I/O端口资源的管理(&nbsp;…
查看>>
Linux对I/O端口资源的管理(&nbsp;…
查看>>
[转载]Linux内核中的platfor…
查看>>
顺序和屏障&nbsp;收藏
查看>>
Linux&nbsp;PCI驱动模型
查看>>
S3C2440上触摸屏驱动实例开发讲解(…
查看>>
Android驱动例子(LED灯控制)(1…
查看>>
第二章&nbsp;Android内核和驱动程序(转)
查看>>
第一章&nbsp;Android系统介绍
查看>>
Android电源管理(zz)
查看>>
Android&nbsp;HAL基础
查看>>
Android电源管理(zz)
查看>>
Android平台开发-Android&nbsp;HAL&nbsp;deve…
查看>>
Android&nbsp;HAL基础
查看>>
2011年06月21日
查看>>