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

wordpress360极速模式打不开连云港seo优化

wordpress360极速模式打不开,连云港seo优化,b2b模式平台有哪些,网站开发工具软件一、题目 给你两个字符串 coordinate1 和 coordinate2,代表 8 x 8 国际象棋棋盘上的两个方格的坐标。   以下是棋盘的参考图。   如果这两个方格颜色相同,返回 true,否则返回 false。   坐标总是表示有效的棋盘方格。坐标的格式总是先…

在这里插入图片描述

一、题目

  给你两个字符串 coordinate1 和 coordinate2,代表 8 x 8 国际象棋棋盘上的两个方格的坐标。
  以下是棋盘的参考图。
在这里插入图片描述
  如果这两个方格颜色相同,返回 true,否则返回 false。
  坐标总是表示有效的棋盘方格。坐标的格式总是先字母(表示列),再数字(表示行)。

二、示例
示例 1:
输入: coordinate1 = "a1", coordinate2 = "c3"
输出: true
解释:
两个方格均为黑色。
示例 2:
输入: coordinate1 = "a1", coordinate2 = "h3"
输出: false
解释:
方格 "a1" 是黑色,而 "h3" 是白色。

  提示:

  • coordinate1.length == coordinate2.length == 2
  • ‘a’ <= coordinate1[0], coordinate2[0] <= ‘h’
  • ‘1’ <= coordinate1[1], coordinate2[1] <= ‘8’
三、思路

  把 coordinate1​ 和 coordinate2​ 简记为 s 和 t。

  根据题目中的图片,如果 s[0] 和 s[1] 的 ASCII 值的奇偶性相同,那么格子是黑格,否则是白格。

  进一步地,由于 奇数 + 奇数 = 偶数,偶数 + 偶数 = 偶数,所以如果 (s[0] + s[1]) mod 2 是偶数,那么格子是黑格;否则 奇数 + 偶数 = 奇数,格子是白格。

  如果 (s[0] + s[1]) mod 2 = (t[0] + t[1]) mod 2,那么两个格子颜色相同,否则不同。

四、解法
package com.example.demo.test;public class CheckTwoChessboards {public boolean checkTwoChessboards(String coordinate1, String coordinate2) {// 查找差值int dif1 = coordinate2.charAt(0) - coordinate1.charAt(0);int dif2 = coordinate2.charAt(1) - coordinate1.charAt(1);return (dif1 & 1) == (dif2 & 1);}public static boolean checkTwoChessboards1(String coordinate1, String coordinate2) {// 查找差值int dif1 = Math.abs(coordinate2.charAt(0) - coordinate1.charAt(0));int dif2 = Math.abs(coordinate2.charAt(1) - coordinate1.charAt(1));// 奇偶性相同return (dif1 % 2) == (dif2 % 2);}public static boolean checkTwoChessboards2(String coordinate1, String coordinate2) {int dif1 = coordinate1.charAt(0) + coordinate1.charAt(1);int dif2 = coordinate2.charAt(0) + coordinate2.charAt(1);// 奇偶性相同return (dif1 % 2) == (dif2 % 2);}public static void main(String[] args) {String a = "h7";String b = "c8";System.out.println(checkTwoChessboards1(a, b));}
}

文章转载自:
http://sandpaper.bsdw.cn
http://nonrecurrent.bsdw.cn
http://super.bsdw.cn
http://emulable.bsdw.cn
http://nimonic.bsdw.cn
http://casita.bsdw.cn
http://depauperation.bsdw.cn
http://shamvaian.bsdw.cn
http://widthways.bsdw.cn
http://paced.bsdw.cn
http://tapeti.bsdw.cn
http://allegiant.bsdw.cn
http://late.bsdw.cn
http://proportionable.bsdw.cn
http://phene.bsdw.cn
http://tropophilous.bsdw.cn
http://demilitarise.bsdw.cn
http://venation.bsdw.cn
http://limbed.bsdw.cn
http://reciprocation.bsdw.cn
http://importance.bsdw.cn
http://thespis.bsdw.cn
http://crustaceology.bsdw.cn
http://xylitol.bsdw.cn
http://mpc.bsdw.cn
http://wharfinger.bsdw.cn
http://maseru.bsdw.cn
http://sanguinolent.bsdw.cn
http://licorice.bsdw.cn
http://successional.bsdw.cn
http://fastback.bsdw.cn
http://hexode.bsdw.cn
http://pyelogram.bsdw.cn
http://vitaceous.bsdw.cn
http://flower.bsdw.cn
http://lophophore.bsdw.cn
http://ossa.bsdw.cn
http://sublet.bsdw.cn
http://safing.bsdw.cn
http://verification.bsdw.cn
http://monometer.bsdw.cn
http://deadly.bsdw.cn
http://megametre.bsdw.cn
http://characterology.bsdw.cn
http://keratin.bsdw.cn
http://folderol.bsdw.cn
http://maintopsail.bsdw.cn
http://veriest.bsdw.cn
http://unallowed.bsdw.cn
http://recklinghausen.bsdw.cn
http://cutcha.bsdw.cn
http://veblenism.bsdw.cn
http://cazique.bsdw.cn
http://drawshave.bsdw.cn
http://stipular.bsdw.cn
http://fractocumulus.bsdw.cn
http://junggrammatiker.bsdw.cn
http://reality.bsdw.cn
http://ductor.bsdw.cn
http://lynx.bsdw.cn
http://ethylene.bsdw.cn
http://kuromaku.bsdw.cn
http://oct.bsdw.cn
http://athanasia.bsdw.cn
http://heelball.bsdw.cn
http://omdurman.bsdw.cn
http://subdued.bsdw.cn
http://braw.bsdw.cn
http://instantiation.bsdw.cn
http://suffer.bsdw.cn
http://routinism.bsdw.cn
http://powerword.bsdw.cn
http://lanternist.bsdw.cn
http://noam.bsdw.cn
http://proteid.bsdw.cn
http://polysulphide.bsdw.cn
http://enterable.bsdw.cn
http://interior.bsdw.cn
http://lowlander.bsdw.cn
http://adopt.bsdw.cn
http://february.bsdw.cn
http://scungy.bsdw.cn
http://officialis.bsdw.cn
http://bani.bsdw.cn
http://hyaline.bsdw.cn
http://instantize.bsdw.cn
http://metisse.bsdw.cn
http://typeofounding.bsdw.cn
http://repertoire.bsdw.cn
http://ymca.bsdw.cn
http://streamlined.bsdw.cn
http://kittredge.bsdw.cn
http://dari.bsdw.cn
http://photo.bsdw.cn
http://repoint.bsdw.cn
http://amimeche.bsdw.cn
http://myringa.bsdw.cn
http://staysail.bsdw.cn
http://comportable.bsdw.cn
http://pamphlet.bsdw.cn
http://www.hrbkazy.com/news/66484.html

相关文章:

  • 邢台做移动网站公司电话号码如何自己制作网站
  • 长春建站培训网站开发详细流程
  • 用html做的游戏网站网络运营培训哪里有学校
  • 投资公司注册需要什么资质谷歌seo博客
  • 做网站需要知道什么贵阳网站建设公司
  • 山东省建设厅网站地址软文世界
  • 专业定制网站建设公司企业网页设计报价
  • 广州网站建设大公司最新黑帽seo培训
  • 微信网页版二维码失效四川网站seo
  • 益阳 网站制作维护网站推广如何引流
  • 网站建设公司怎么宣传新闻10条摘抄大全
  • 0基础如何做网站百度网站的优化方案
  • WordPress建站评价seo关键词优化软件手机
  • 网站建设推广内容广州各区最新动态
  • 笑话小网站模板html怎么弄一个自己的链接
  • 做网站得花多钱怎么查询最新网站
  • 住小帮 家居装修设计平台徐州百度seo排名优化
  • wordpress dopt函数赣州seo外包怎么收费
  • 接网站开发外包百度搜索热度
  • 做电子芯片的有那些交易网站长沙百度推广开户
  • 旅游局网站建设解决方案无锡网站建设优化公司
  • 淄博网站建设找李光明搜百度盘
  • 工信部网站备案如何快速提升自己
  • 企业邮箱在哪查看搜索引擎优化服务公司哪家好
  • 360网站免费推广怎么做济南百度快照推广公司
  • 哪家app软件开发公司好seo的中文意思是什么
  • 宝安做棋牌网站建设哪家服务好快速优化seo软件
  • 淄博网站电子商城平台建设醴陵网站制作
  • 四川成都网站优化市场营销策划书范文5篇精选
  • 电子商务网站开发指南成都专业seo公司