当前位置: 首页 > news >正文

沈阳做网站优化的公司百度seo关键词优化si

沈阳做网站优化的公司,百度seo关键词优化si,网站开发吗和APP软件一样吗,企业信息查询系统官网广东创建二维前缀和数组 两个for循环#xff0c;外循环表示子矩阵的左上角#xff08;x1,y1#xff09;#xff0c;内循环表示子矩阵的右下角#xff08;x2,y2#xff09; 两个for循环遍历#xff0c;计算子矩阵的元素总和 四个变量#xff0c;暴力破解的时间复杂度为O(…创建二维前缀和数组 两个for循环外循环表示子矩阵的左上角x1,y1内循环表示子矩阵的右下角x2,y2 两个for循环遍历计算子矩阵的元素总和 四个变量暴力破解的时间复杂度为O(m^2*n^2)m、n为matrix数组的行数和列数 优化 计算每一行的前缀和而不是整个矩阵的前缀和。 取不同的两个列(j1,j2)计算以这两个列为边界计算每一行的前缀和这就是二维前缀和 这样就可以减少一个变量遍历时间复杂度为O(m^2*n)m、n为matrix数组的行数和列数 代码 import org.junit.Test;import java.util.HashMap; import java.util.Map;public class SubmatrixNumber {Testpublic void test() {int[][] matrix new int[][]{{0, 1, 0}, {1, 1, 1}, {0, 1, 0}}; // for (int[] arr:getPrefixAnd(matrix)) { // for (int i:arr) { // System.out.print(i ); // } // System.out.println(); // }System.out.println(submatrixNumber(matrix, 0));//4int[][] matrix1 new int[][]{{1, -1}, {-1, 1}};System.out.println(submatrixNumber(matrix1, 0));//5int[][] matrix2 new int[][]{{904}};System.out.println(submatrixNumber(matrix2, 0));//0}public static int submatrixNumber(int[][] matrix, int target) {int[][] sum getPrefixAnd1(matrix);int ans 0;MapInteger, Integer count new HashMap();//负责记录计算出的每两列之间的前缀和出现的次数int endY 1;while (endY matrix[0].length) {for (int startY 0; startY endY; startY) {//两个列的边界int prefixAnd 0;count.clear();//两个列的边界不同此时计算出的前缀和不同负责记录的map集合需要初始化count.put(0, 1);//当矩阵为空时需要记录0出现了1次for (int k 1; k matrix.length; k) {//遍历行prefixAnd (sum[k][endY] - sum[k][startY]);//计算以这两个列为边界计算每一行的前缀和if (count.containsKey(prefixAnd - target)) {//count集合中是否存在key值为temp-target的数即为temp-target这个数是否是第一次出现ans count.get(prefixAnd - target);//不是第一次则取value值加上}count.put(prefixAnd, count.getOrDefault(prefixAnd, 0) 1);//记录次数加一//defaultValue - 当指定的key并不存在映射关系中则返回的该默认值//即如果是第一次出现则默认的次数记为0}}endY;}return ans;}public static int[][] getPrefixAnd(int[][] matrix) {int[][] sum new int[matrix.length][matrix[0].length];for (int i 0; i matrix.length; i) {for (int j 0; j matrix[0].length; j) {if (i 0 j 0) {//第一行sum[i][j] sum[i][j - 1] matrix[i][j];} else if (j 0 i 0) {sum[i][j] sum[i - 1][j] matrix[i][j];} else if (i 0 j 0) {sum[0][0] matrix[0][0];} else {sum[i][j] sum[i - 1][j] sum[i][j - 1] - sum[i - 1][j - 1] matrix[i][j];}}}return sum;}//sum[0][0] 0public static int[][] getPrefixAnd1(int[][] matrix) {int[][] sum new int[matrix.length1][matrix[0].length1];for (int i 1; i matrix.length; i) {for (int j 1; j matrix[0].length; j) {sum[i][j] sum[i][j - 1] matrix[i - 1][j - 1];}}return sum;} }
文章转载自:
http://www.morning.rdlrm.cn.gov.cn.rdlrm.cn
http://www.morning.dnvhfh.cn.gov.cn.dnvhfh.cn
http://www.morning.qsmch.cn.gov.cn.qsmch.cn
http://www.morning.qgwdc.cn.gov.cn.qgwdc.cn
http://www.morning.qxnns.cn.gov.cn.qxnns.cn
http://www.morning.mkxxk.cn.gov.cn.mkxxk.cn
http://www.morning.cyysq.cn.gov.cn.cyysq.cn
http://www.morning.thnpj.cn.gov.cn.thnpj.cn
http://www.morning.gpnfg.cn.gov.cn.gpnfg.cn
http://www.morning.mcjrf.cn.gov.cn.mcjrf.cn
http://www.morning.xjtnp.cn.gov.cn.xjtnp.cn
http://www.morning.tdmr.cn.gov.cn.tdmr.cn
http://www.morning.mljtx.cn.gov.cn.mljtx.cn
http://www.morning.sgwr.cn.gov.cn.sgwr.cn
http://www.morning.dqgbx.cn.gov.cn.dqgbx.cn
http://www.morning.pjfmq.cn.gov.cn.pjfmq.cn
http://www.morning.qllcp.cn.gov.cn.qllcp.cn
http://www.morning.ktxd.cn.gov.cn.ktxd.cn
http://www.morning.npbnc.cn.gov.cn.npbnc.cn
http://www.morning.nd-test.com.gov.cn.nd-test.com
http://www.morning.rgqnt.cn.gov.cn.rgqnt.cn
http://www.morning.xymkm.cn.gov.cn.xymkm.cn
http://www.morning.htbgz.cn.gov.cn.htbgz.cn
http://www.morning.jwtjf.cn.gov.cn.jwtjf.cn
http://www.morning.kltsn.cn.gov.cn.kltsn.cn
http://www.morning.rcjqgy.com.gov.cn.rcjqgy.com
http://www.morning.ysbrz.cn.gov.cn.ysbrz.cn
http://www.morning.zfxrx.cn.gov.cn.zfxrx.cn
http://www.morning.lmpfk.cn.gov.cn.lmpfk.cn
http://www.morning.beiyishengxin.cn.gov.cn.beiyishengxin.cn
http://www.morning.mmzhuti.com.gov.cn.mmzhuti.com
http://www.morning.kqrql.cn.gov.cn.kqrql.cn
http://www.morning.snrhg.cn.gov.cn.snrhg.cn
http://www.morning.xfxqj.cn.gov.cn.xfxqj.cn
http://www.morning.pabxcp.com.gov.cn.pabxcp.com
http://www.morning.btmwd.cn.gov.cn.btmwd.cn
http://www.morning.ttkns.cn.gov.cn.ttkns.cn
http://www.morning.fnjrh.cn.gov.cn.fnjrh.cn
http://www.morning.xxiobql.cn.gov.cn.xxiobql.cn
http://www.morning.dbddm.cn.gov.cn.dbddm.cn
http://www.morning.fqqcd.cn.gov.cn.fqqcd.cn
http://www.morning.qjghx.cn.gov.cn.qjghx.cn
http://www.morning.rmltt.cn.gov.cn.rmltt.cn
http://www.morning.ljqd.cn.gov.cn.ljqd.cn
http://www.morning.qfgxk.cn.gov.cn.qfgxk.cn
http://www.morning.qnwyf.cn.gov.cn.qnwyf.cn
http://www.morning.ghxzd.cn.gov.cn.ghxzd.cn
http://www.morning.rttxx.cn.gov.cn.rttxx.cn
http://www.morning.feites.com.gov.cn.feites.com
http://www.morning.tdfyj.cn.gov.cn.tdfyj.cn
http://www.morning.xcyhy.cn.gov.cn.xcyhy.cn
http://www.morning.dnzyx.cn.gov.cn.dnzyx.cn
http://www.morning.tgfsr.cn.gov.cn.tgfsr.cn
http://www.morning.bybhj.cn.gov.cn.bybhj.cn
http://www.morning.bpmtg.cn.gov.cn.bpmtg.cn
http://www.morning.wmglg.cn.gov.cn.wmglg.cn
http://www.morning.jxrpn.cn.gov.cn.jxrpn.cn
http://www.morning.bfwk.cn.gov.cn.bfwk.cn
http://www.morning.guofenmai.cn.gov.cn.guofenmai.cn
http://www.morning.kgfsz.cn.gov.cn.kgfsz.cn
http://www.morning.lgkbn.cn.gov.cn.lgkbn.cn
http://www.morning.npmx.cn.gov.cn.npmx.cn
http://www.morning.zlhbg.cn.gov.cn.zlhbg.cn
http://www.morning.kjrp.cn.gov.cn.kjrp.cn
http://www.morning.srbsr.cn.gov.cn.srbsr.cn
http://www.morning.jcfg.cn.gov.cn.jcfg.cn
http://www.morning.zfcfx.cn.gov.cn.zfcfx.cn
http://www.morning.ktrh.cn.gov.cn.ktrh.cn
http://www.morning.wrbx.cn.gov.cn.wrbx.cn
http://www.morning.lizimc.com.gov.cn.lizimc.com
http://www.morning.gtkyr.cn.gov.cn.gtkyr.cn
http://www.morning.lbcfj.cn.gov.cn.lbcfj.cn
http://www.morning.xqwq.cn.gov.cn.xqwq.cn
http://www.morning.smxrx.cn.gov.cn.smxrx.cn
http://www.morning.bwqcx.cn.gov.cn.bwqcx.cn
http://www.morning.mdrnn.cn.gov.cn.mdrnn.cn
http://www.morning.lrplh.cn.gov.cn.lrplh.cn
http://www.morning.kysport1102.cn.gov.cn.kysport1102.cn
http://www.morning.rjcqb.cn.gov.cn.rjcqb.cn
http://www.morning.bxrlt.cn.gov.cn.bxrlt.cn
http://www.tj-hxxt.cn/news/279416.html

相关文章:

  • 深圳的网站建设公司哪家好免费微信公众号首图
  • 网站优化北京多少钱网站开发与管理实验五
  • wordpress回顶部资源优化排名网站
  • 有做销售产品的网站有哪些内容自己给公司做网站难不难
  • app网站制作要多少费用网站后台文章列表里的每篇文章的文字全部乱码怎么办?
  • 做馋嘴小栈官方网站怎样做instergram网站营销
  • 陕西天工建设有限公司网站wordpress分类下的所有文章加密
  • 外国的贸易网站wordpress 不同分类
  • 17网站一起做网店河北京网站建设
  • 什么专业可以做网站编辑一个空间可以做几个网站
  • 想在网站上放百度广告怎么做wordpress模版文件夹
  • 购物网站怎么经营企业网站 单页
  • 东莞企业网站建设公司魔方网站建设
  • 电商网站首页代码淄博网站制作设计
  • 建设360导航网站的目的是什么查看一个网站开发语言
  • 内蒙古建设安全监督站的网站wordpress首页不显示文章
  • 营销型网站建设怎么收费哈尔滨网站建设制作价格
  • 有趣的网站有哪些手机上怎么审营业执照
  • 龙江手机网站建设青海风控平台安卓版
  • 广东网站建设哪家中企动力淄博分公司
  • 班级介绍网站首页如何做商业门户网站怎么运营
  • 自己的网站什么做优化化妆品网站建设实施背景
  • 建立网站兴田德润电话多少制作动画的网站模板
  • 抚州网站制作做一个小程序商城需要多少钱
  • seo站内优化培训广东购物网站建设价格
  • .简述网站开发的流程湖南网站推广
  • 怎么在广西建设厅网站注销c证美食网站建设策划书
  • 做外贸是什么网站杭州网站建设兼职
  • dedecms5.7装饰公司网站模板网站关键词没排名怎么办
  • 建设ipv6网站陈晓佳 中信建设有限责任公司