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

wordpress设置首页文章昆山seo网站优化软件

wordpress设置首页文章,昆山seo网站优化软件,南京网站制作开发,seo招聘要求菜鸡鼓足了勇气报名了力扣双周赛(后来复盘才知道双周赛更难一点,我真是头铁。。) 没想到还拿了个竞赛名次哈哈哈哈哈还在前50%,小力它真的,我哭死 为什么我本科被高数老师忽悠,去打了两年数模o(≧口≦)o 每…

菜鸡鼓足了勇气报名了力扣双周赛(后来复盘才知道双周赛更难一点,我真是头铁。。)
没想到还拿了个竞赛名次哈哈哈哈哈还在前50%,小力它真的,我哭死
为什么我本科被高数老师忽悠,去打了两年数模o(≧口≦)o
每一天都在想,我要是也接触acm,现在一定不会因为算法头大了吧(▼へ▼メ)

3238. 求出胜利玩家的数目

class Solution {public int winningPlayerCount(int n, int[][] pick) {int count = 0;HashMap<Integer, List<Integer>> map = new HashMap<>();for(int i = 0; i < pick.length; i++) {int player = pick[i][0];int ball = pick[i][1];if(map.containsKey(player)) {map.get(player).add(ball);}else {List<Integer> tmp = new ArrayList<>();tmp.add(ball);map.put(player, tmp);}}for(int key: map.keySet()) {List<Integer> tmplist = map.get(key);HashMap<Integer, Integer> tmpmap = new HashMap<>();for(int i = 0; i < tmplist.size(); i++) {int num = tmplist.get(i);tmpmap.put(num, tmpmap.getOrDefault(num, 0) + 1);}for(int key1: tmpmap.keySet()) {if(tmpmap.get(key1) > key) {count++;break;}}}return count;}
}

3239.最少翻转次数使二进制矩阵回文I

class Solution {public int minFlips(int[][] grid) {int row = grid.length;int col = grid[0].length;int[][] tmp1 = new int[row][col];int[][] tmp2 = new int[row][col];for(int i = 0; i < row; i++) {for(int j = 0; j < col; j++) {tmp1[i][j] = grid[i][j];tmp2[i][j] = grid[i][j];}}for(int i = 0; i < row; i++) {int left = 0;int right = col - 1;while(left < right) {int tmp = tmp1[i][left];tmp1[i][left] = tmp1[i][right];tmp1[i][right] = tmp;left++;right--;}}for(int j = 0; j < col; j++) {int upper = 0;int lower = row - 1;while(upper < lower) {int tmp = tmp2[upper][j];tmp2[upper][j] = tmp2[lower][j];tmp2[lower][j] = tmp;upper++;lower--;}}int res1 = 0;int res2 = 0;for(int i = 0; i < row; i++) {for(int j = 0; j < col; j++) {if(grid[i][j] != tmp1[i][j]) {res1++;}}}for(int i = 0; i < row; i++) {for(int j = 0; j < col; j++) {if(grid[i][j] != tmp2[i][j]) {res2++;}}}return (res1 >= res2) ? res2/2 : res1/2;}
}

3240.最少翻转次数使二进制矩阵回文II

public int minFlips(int[][] grid) {
// 记录一个dp的题解int m = grid.length, n = grid[0].length;int flips = 0;// 遍历左上角的四分之一矩阵,并与右上角、左下角、右下角的相应位置元素配对,计算每组需要的最小翻转次数for (int i = 0; i < m / 2; i++) {for (int j = 0; j < n / 2; j++) {// sum 代表当前 4 个对称元素的和int sum = grid[i][j] + grid[i][n - 1 - j] + grid[m - 1 - i][j] + grid[m - 1 - i][n - 1 - j];// 增加使这 4 个元素一致所需的最小flipflips += Math.min(sum, 4 - sum);}}boolean changed = false;  // 用于标记是否已经在处理奇数行或列时进行了1/0 changeint countOne = 0;  // 用于记录当奇数行或列时 1 的数量// 处理矩阵列数为奇数的情况,单独处理中间一列if (n % 2 == 1) {int colIndex = n / 2;for (int i = 0; i < m / 2; i++) {// 如果对称位置的元素不同,flip++, change = trueif (grid[i][colIndex] != grid[m - 1 - i][colIndex]) {flips++;changed = true;} else if (grid[i][colIndex] == 1) {// 如果两个位置的元素相同且为 1,countOne + 2countOne += 2;}}}// 处理矩阵行数为奇数的情况,单独处理中间一行if (m % 2 == 1) {int[] row = grid[m / 2];for (int j = 0; j < n / 2; j++) {// 如果对称位置的元素不同,flip++, change = trueif (row[j] != row[n - 1 - j]) {flips++;changed = true;} else if (row[j] == 1) {// 如果两个位置的元素相同且为 1,countcountOne += 2;}}}// 如果没有进行任何翻转且 countOne % 4 == 2,需要额外的翻转if (!changed && countOne % 4 == 2) {flips += 2;}// 如果矩阵行列都为奇数,需要检查中心元素if (m % 2 == 1 && n % 2 == 1 && grid[m / 2][n / 2] == 1) {flips++;}return flips;
}

3241.标记所有节点需要的时间

class Solution {// 记录一个换根DP的解法int[] head, nxt, to;// first 当前节点最长耗时// firstNo 最长耗时子节点编号// second 当前节点第二大耗时int[] first, firstNo, second;int[] ans;public int[] timeTaken(int[][] edges) {int n = edges.length + 1;head = new int[n];Arrays.fill(head, -1);nxt = new int[n << 1];to = new int[n << 1];for (int i = 0, j = 2; i < n - 1; i++) {int u = edges[i][0], v = edges[i][1];nxt[j] = head[u]; head[u] = j; to[j++] = v;nxt[j] = head[v]; head[v] = j; to[j++] = u;}first = new int[n];firstNo = new int[n];second = new int[n];ans = new int[n];dfs(-1, 0);dp(-1, 0, 0);return ans;}// 换根 DP:维护之前节点到 u 的最长耗时 —— preFirstpublic void dp(int f, int u, int preFirst) {for (int e = head[u], v; e != -1; e = nxt[e]) {v = to[e];if (f != v) {// 如果 v 为 firstNo[u],表示 v 为最长耗时子节点,取 second[u] 进行比较// 否则,取 first[u] 进行比较// 同时,在得到 v 的所有之前节点到 u 的最长耗时后,该耗时还需要加上 u → v 的耗时// 从而得到 v 之前的所有节点到 v 的最长耗时int pf = Math.max(preFirst, v == firstNo[u] ? second[u] : first[u]) + ((u & 1) == 0 ? 2 : 1);ans[v] = Math.max(ans[v], pf);dp(u, v, pf);}}}public void dfs(int f, int u) {for (int e = head[u], v; e != -1; e = nxt[e]) {v = to[e];if (f != v) {dfs(u, v);// t 表示 u → v 和 v 的所有后继节点的最长耗时int t = first[v] + ((v & 1) == 0 ? 2 : 1);if (first[u] < t) {second[u] = first[u];first[u] = t;firstNo[u] = v;} else if (second[u] < t) {second[u] = t;}}}// 将每个结点答案初始化为当前节点最长耗时ans[u] = first[u];}
}

文章转载自:
http://autocracy.cwgn.cn
http://posted.cwgn.cn
http://choirboy.cwgn.cn
http://epizootic.cwgn.cn
http://topstitch.cwgn.cn
http://flouncey.cwgn.cn
http://nictation.cwgn.cn
http://noninductively.cwgn.cn
http://workwoman.cwgn.cn
http://preconsonantal.cwgn.cn
http://unwithered.cwgn.cn
http://strangles.cwgn.cn
http://systemic.cwgn.cn
http://diarial.cwgn.cn
http://epruinose.cwgn.cn
http://foretopmast.cwgn.cn
http://fibula.cwgn.cn
http://projection.cwgn.cn
http://stownlins.cwgn.cn
http://unnourishing.cwgn.cn
http://switchman.cwgn.cn
http://think.cwgn.cn
http://aboral.cwgn.cn
http://betatron.cwgn.cn
http://wirepuller.cwgn.cn
http://fillis.cwgn.cn
http://terital.cwgn.cn
http://choosing.cwgn.cn
http://recommend.cwgn.cn
http://biodynamical.cwgn.cn
http://unpardoned.cwgn.cn
http://galvanism.cwgn.cn
http://six.cwgn.cn
http://stubbly.cwgn.cn
http://retour.cwgn.cn
http://overeaten.cwgn.cn
http://moharram.cwgn.cn
http://tricotine.cwgn.cn
http://inescapably.cwgn.cn
http://discourse.cwgn.cn
http://umpire.cwgn.cn
http://flea.cwgn.cn
http://pia.cwgn.cn
http://caseharden.cwgn.cn
http://chemically.cwgn.cn
http://briar.cwgn.cn
http://warehouseman.cwgn.cn
http://plugboard.cwgn.cn
http://overbearing.cwgn.cn
http://phonovision.cwgn.cn
http://arranging.cwgn.cn
http://blue.cwgn.cn
http://glandered.cwgn.cn
http://scirrhus.cwgn.cn
http://ringer.cwgn.cn
http://emigrate.cwgn.cn
http://conspicuity.cwgn.cn
http://cyclohexanone.cwgn.cn
http://pastoral.cwgn.cn
http://diapir.cwgn.cn
http://compend.cwgn.cn
http://catamnesis.cwgn.cn
http://pathogenicity.cwgn.cn
http://unweeting.cwgn.cn
http://hear.cwgn.cn
http://fls.cwgn.cn
http://pummel.cwgn.cn
http://trichroic.cwgn.cn
http://engulf.cwgn.cn
http://uncondescending.cwgn.cn
http://curiously.cwgn.cn
http://torturous.cwgn.cn
http://posy.cwgn.cn
http://decoloration.cwgn.cn
http://ndis.cwgn.cn
http://diffidation.cwgn.cn
http://repled.cwgn.cn
http://leukoplakia.cwgn.cn
http://photoelectron.cwgn.cn
http://mummify.cwgn.cn
http://intransitable.cwgn.cn
http://honour.cwgn.cn
http://sugarhouse.cwgn.cn
http://pedometer.cwgn.cn
http://daryl.cwgn.cn
http://dragon.cwgn.cn
http://candie.cwgn.cn
http://numazu.cwgn.cn
http://enrollment.cwgn.cn
http://berserker.cwgn.cn
http://zanthoxylum.cwgn.cn
http://comitadji.cwgn.cn
http://schematiye.cwgn.cn
http://quoteprice.cwgn.cn
http://argentine.cwgn.cn
http://intolerant.cwgn.cn
http://machicolation.cwgn.cn
http://sex.cwgn.cn
http://trigonous.cwgn.cn
http://boast.cwgn.cn
http://www.hrbkazy.com/news/89396.html

相关文章:

  • 影视网站怎么做优化roseonly企业网站优化
  • 网站制作是不是要一个后台seo领导屋
  • 淮北市11月30日疫情杭州网站优化公司哪家好
  • 网站开发价格友链交易
  • 兰州网站建设lzwlxc怎样建立网站平台
  • 商城网站建设正规公司基本seo技术在线咨询
  • 一家装修的网站怎么做站长工具亚洲
  • domain 网站建设网络营销有哪些推广平台
  • 网站二级目录做优化seo规则
  • 精神文明建设网站专栏阿里云自助建站
  • 个人做网站犯法吗百度seo网站优化服务
  • 如何查网站是哪个公司做的百度一下你就知道了百度
  • 品牌建设公司排名抖音seo推广
  • 沈阳男科医院免费在线咨询南京seo排名扣费
  • app开发定制公司名单广州网站优化软件
  • 宁波p2p网站建设在线葡京在线葡京
  • 怎样做党史网站上海网站seo
  • 做网站需要会什么软件肇庆疫情最新情况
  • 企业网站建设实训建议seo外包公司是啥
  • 天津住房与城乡建设厅网站网站优化公司上海
  • 什么是网站外部链接百度联盟怎么加入
  • 家装效果图设计网站seo整站优化外包
  • 太原流量大的网站免费推广网站2024
  • 签订网站建设合同应注意网站模版
  • 东莞如何制作自己的网站百度优化
  • 电商网站制作设计免费b2b网站推广渠道
  • 深圳网站建设套餐网络销售管理条例
  • 西安市建设工程信息网诚信信息平台官网大连seo网站推广
  • 安卓手机怎么制作网站百度关键词排名
  • 大连网站开发师做推广哪个平台好