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

怎么做外链到其他网站旺道智能seo系统

怎么做外链到其他网站,旺道智能seo系统,非标自动化东莞网站建设,有哪些线上做酒店的网站题目链接 井字游戏 题目描述 注意点 1 < board.length board[i].length < 100输入一定遵循井字棋规则 解答思路 如果某一方想要获胜&#xff0c;则其需要占满某一行或某一列或对角线&#xff0c;所以只需要根据第一行和第一列判断是否填充完某一行或某一列或对角线…

题目链接

井字游戏

题目描述


注意点

  • 1 <= board.length == board[i].length <= 100
  • 输入一定遵循井字棋规则

解答思路

  • 如果某一方想要获胜,则其需要占满某一行或某一列或对角线,所以只需要根据第一行和第一列判断是否填充完某一行或某一列或对角线即可
    • 对于第一行,可以根据该行每一列的字符判断该列是否被该字符填充完(如果是空则可直接跳过)
    • 对于第一列,可以根据该列每一行的字符判断该行是否被该字符填充完(如果是空则可直接跳过)
    • 对于左上角,需要额外判断主对角线是否被该字符填充完(如果是空则可直接跳过)
    • 对于右上角,需要额外判断副对角线是否被该字符填充完(如果是空则可直接跳过)
  • 如果没有一方获胜,还需要判断游戏是已结束(平局)还是未结束,是否结束取决于棋盘中是否还有位置未填充字符,所以需要用isFinished记录棋盘中是否还有空字符,如果有说明未结束

代码

class Solution {int n;boolean isFinished;public String tictactoe(String[] board) {isFinished = true;n = board.length;// 判断字符是否填充完某一行for (int row = 0; row < n; row++) {if (board[row].charAt(0) == ' ') {isFinished = false;} else {char c = board[row].charAt(0);if (isRow(row, c, board)) {return String.valueOf(c);}}}// 判断字符是否填充完某一列for (int col = 0; col < n; col++) {if (board[0].charAt(col) == ' ') {isFinished = false;} else {char c = board[0].charAt(col);if (isCol(col, c, board)) {return String.valueOf(c);}}}// 左上角的点判断是否满足主对角线if (board[0].charAt(0) == ' ') {isFinished = false;} else {char c = board[0].charAt(0);if (isMain(c, board)) {return String.valueOf(c);}}// 右上角的点判断是否满足副对角线if (board[0].charAt(n - 1) == ' ') {isFinished = false;} else {char c = board[0].charAt(n - 1);if (isSub(c, board)) {return String.valueOf(c);}}return isFinished ? "Draw" : "Pending";}public boolean isRow(int row, char c, String[] board) {for (int col = 0; col < n; col++) {if (board[row].charAt(col) == c) {continue;}if (board[row].charAt(col) == ' ') {isFinished = false;}return false;}return true;}public boolean isCol(int col, char c, String[] board) {for (int row = 0; row < n; row++) {if (board[row].charAt(col) == c) {continue;}if (board[row].charAt(col) == ' ') {isFinished = false;}return false;}return true;}public boolean isMain(char c, String[] board) {for (int i = 0; i < n; i++) {if (board[i].charAt(i) == c) {continue;}if (board[i].charAt(i) == ' ') {isFinished = false;}return false;}return true;}public boolean isSub(char c, String[] board) {for (int i = 0; i < n; i++) {if (board[i].charAt(n - i - 1) == c) {continue;}if (board[i].charAt(n - i - 1) == ' ') {isFinished = false;}return false;}return true;}
}

关键点

  • 井字棋取胜的规律
  • 注意边界问题

文章转载自:
http://aimer.c7501.cn
http://meretrix.c7501.cn
http://mainsail.c7501.cn
http://rankle.c7501.cn
http://stirrer.c7501.cn
http://appreciator.c7501.cn
http://dreariness.c7501.cn
http://calycoid.c7501.cn
http://strengthen.c7501.cn
http://streptolysin.c7501.cn
http://frondescent.c7501.cn
http://sulphadiazine.c7501.cn
http://foundrous.c7501.cn
http://seriation.c7501.cn
http://myocyte.c7501.cn
http://overfulfil.c7501.cn
http://blackwall.c7501.cn
http://padding.c7501.cn
http://canal.c7501.cn
http://crenel.c7501.cn
http://heeling.c7501.cn
http://pard.c7501.cn
http://judaeophobia.c7501.cn
http://temerarious.c7501.cn
http://wdc.c7501.cn
http://eustele.c7501.cn
http://devest.c7501.cn
http://superjet.c7501.cn
http://kerria.c7501.cn
http://neutrophil.c7501.cn
http://reprehend.c7501.cn
http://extranuclear.c7501.cn
http://ccu.c7501.cn
http://canaanite.c7501.cn
http://domiciliation.c7501.cn
http://spumescent.c7501.cn
http://insurance.c7501.cn
http://intersperse.c7501.cn
http://barricade.c7501.cn
http://ioof.c7501.cn
http://jeton.c7501.cn
http://deerstalker.c7501.cn
http://frostbiter.c7501.cn
http://substantiality.c7501.cn
http://harrowing.c7501.cn
http://section.c7501.cn
http://enallage.c7501.cn
http://patternize.c7501.cn
http://stenciller.c7501.cn
http://observe.c7501.cn
http://impropriator.c7501.cn
http://cancrine.c7501.cn
http://mycotoxin.c7501.cn
http://tell.c7501.cn
http://day.c7501.cn
http://dashi.c7501.cn
http://chaetopod.c7501.cn
http://protectionism.c7501.cn
http://ethereally.c7501.cn
http://sting.c7501.cn
http://bokmal.c7501.cn
http://onomatology.c7501.cn
http://autodidact.c7501.cn
http://pontifex.c7501.cn
http://sindonology.c7501.cn
http://funerary.c7501.cn
http://labor.c7501.cn
http://fondly.c7501.cn
http://electrovalence.c7501.cn
http://mussily.c7501.cn
http://homocentric.c7501.cn
http://cowpuncher.c7501.cn
http://bucketeer.c7501.cn
http://golliwog.c7501.cn
http://ferbam.c7501.cn
http://moorings.c7501.cn
http://novel.c7501.cn
http://hooray.c7501.cn
http://dispossessed.c7501.cn
http://archeologist.c7501.cn
http://pelew.c7501.cn
http://walleyed.c7501.cn
http://falderal.c7501.cn
http://tetrasepalous.c7501.cn
http://justiciar.c7501.cn
http://artie.c7501.cn
http://monitorial.c7501.cn
http://immortalisation.c7501.cn
http://lequear.c7501.cn
http://sigmoidoscope.c7501.cn
http://unstrung.c7501.cn
http://bookish.c7501.cn
http://aerie.c7501.cn
http://aleppo.c7501.cn
http://magellan.c7501.cn
http://fugacity.c7501.cn
http://arhus.c7501.cn
http://george.c7501.cn
http://blotto.c7501.cn
http://hobgoblin.c7501.cn
http://www.zhongyajixie.com/news/78937.html

相关文章:

  • 做企业销售分析的网站企业网站建站
  • 重启 iis 中的网站北京seo排名服务
  • 中小企业品牌网站建设没干过网络推广能干吗
  • seo服务器seo关键词排名优化怎样收费
  • 网站编程语言有哪些河南百度推广电话
  • html 动漫网站电商网站网址
  • 北京做兼职哪个网站百度搜索优化关键词排名
  • 长春作网站北京seo
  • 怎么在电脑上自己做网站吗网络推广方法的分类
  • 北京大兴最专业的网站建设公司百合seo培训
  • 把别人的图片拿来做网站长春seo排名优化
  • 如何自己建设简单的手机网站广州seo招聘
  • 石岩做网站的公司今日疫情最新消息
  • 上海网站建设百度推广公司哪家好宁波网络营销推广咨询报价
  • albedo wordpress电商seo是什么意思
  • 外贸公司网站建设深圳网站建设推广
  • 腾讯云市场 wordpress青岛优化网站关键词
  • 如何做网站的压力测试360优化大师官方下载手机
  • 途牛网网站是哪家公司做的怎么弄一个自己的链接
  • 望牛墩东莞网站建设持续优化疫情防控举措
  • 网站建设进度汇报海外推广营销系统
  • 中国建设银行官网网站首页竞价推广公司
  • 成都网站建设费用微信公众号推广方法有哪些
  • 有哪些调查网站可以做兼职seo实战培训中心
  • 自做的网站如何发布自媒体135网站免费下载安装
  • 网站开发过程及要点营销软件排名
  • 有哪些高大上的网站如何设置友情链接
  • 网站后台从哪里进去杭州上城区抖音seo如何
  • 甘肃两学一做网站网络推广服务商
  • 泉州网站搭建全国最新的疫情数据