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

怎么修复网站死链今天特大军事新闻事件

怎么修复网站死链,今天特大军事新闻事件,wordpress小说网站模板,唐山网站建设400多少钱五子棋对弈 问题描述 “在五子棋的对弈中#xff0c;友谊的小船说翻就翻#xff1f;” 不#xff01;对小蓝和小桥来说#xff0c;五子棋不仅是棋盘上的较量#xff0c;更是心与心之间的沟通。这两位挚友秉承着友谊第一#xff0c;比赛第二的宗旨#xff…五子棋对弈 问题描述 “在五子棋的对弈中友谊的小船说翻就翻” 不对小蓝和小桥来说五子棋不仅是棋盘上的较量更是心与心之间的沟通。这两位挚友秉承着友谊第一比赛第二的宗旨决定在一块 5×5 的棋盘上用黑白两色的棋子来决出胜负。但他们又都不忍心让对方失落于是决定用一场和棋平局作为彼此友谊的见证。 比赛遵循以下规则 棋盘规模比赛在一个 5×5 的方格棋盘上进行共有 25 个格子供下棋使用。棋子类型两种棋子黑棋与白棋代表双方。小蓝持白棋小桥持黑棋。先手规则白棋小蓝具有先手优势即在棋盘空白时率先落子下棋。轮流落子玩家们交替在棋盘上放置各自的棋子每次仅放置一枚。胜利条件率先在横线、竖线或斜线上形成连续的五个同色棋子的一方获胜。平局条件当所有 25 个棋盘格都被下满棋子而未决出胜负时游戏以平局告终。 在这一设定下小蓝和小桥想知道有多少种不同的棋局情况既确保棋盘下满又保证比赛结果为平局。 答案提交 这是一道结果填空题你只需要算出结果后提交即可。本题的结果为一个整数在提交答案时只填写这个整数填写多余的内容将无法得分。 c代码 #includebits/stdc.husing namespace std;class check { public:int cur;int left;int up;int slash;int slash_fu; };int white 0, black 0; check chess[5][5]; int ans 0;void dfs(int i, int j, int cur) {chess[i][j].left 1;chess[i][j].up 1;chess[i][j].slash 1;chess[i][j].slash_fu 1;if (j 1 cur chess[i][j - 1].cur) {if (chess[i][j - 1].left 4) return;chess[i][j].left chess[i][j - 1].left 1;}if (i 1 cur chess[i - 1][j].cur) {if (chess[i - 1][j].up 4) return;chess[i][j].up chess[i - 1][j].up 1;}if (i 1 j 1 cur chess[i - 1][j - 1].cur) {if (chess[i - 1][j - 1].slash 4) return;chess[i][j].slash chess[i - 1][j - 1].slash 1;}if (i 1 j 1 4 cur chess[i - 1][j 1].cur) {if (chess[i - 1][j 1].slash_fu 4) return;chess[i][j].slash_fu chess[i - 1][j 1].slash_fu 1;}chess[i][j].cur cur;if (i 4 j 4) {ans;return;}int x, y;x i;y j 1;if (j 4) {x i 1;y 0;}if (white 13) {white;dfs(x, y, 0);white--;}if (black 12) {black;dfs(x, y, 1);black--;} }int main() {/*white;dfs(0, 0, 0);white--;black;dfs(0, 0, 1);black--;cout ans;*/cout 3126376;return 0; }//by wqs题目解析 该问题是一个dfs深度搜索问题不过要剪枝。 因为从左往右从上往下填所以可以不用考虑棋盘右边和下面的情况。 如果左边有四个和当前颜色相同直接return; 如果上边有四个和当前颜色相同直接return; 如果主对角线斜向上有四个和当前颜色相同直接return; 如果副对角线斜向上有四个和当前颜色相同直接return; 我当时还不记得考虑副对角线了不知道算不算坑。 另外白子13个黑子12个要判断黑子、白子数量是否大于0再考虑下什么棋子。 代码实现 check类 class check { public:int cur; //当前棋子的颜色0表示白棋1表示黑棋int left;//左边棋子连珠个数(连珠个数指的是连续颜色相同的棋子数量包含自己)int up;//上边棋子连珠个数int slash;//主对角线棋子连珠个数int slash_fu;//副对角线棋子连珠个数 }; check chess[5][5];//模拟棋盘真实情况 //如果chess[i][j].cur chess[i][j - 1].cur,chess[i][j].left chess[i][j - 1].left 1; //如果我填入的这个棋子m的颜色和左边棋子n的颜色相同,m的左边棋子连珠数量n的左边棋子连珠数量1; //如果chess[i][j].cur ! chess[i][j - 1].cur,chess[i][j].left 1; //如果我填入的这个棋子m的颜色和左边棋子n的颜色不相同,m的左边棋子连珠数量1; //其他位置的动态转移方程自行推导。dfs深度搜索 //在chess[i][j]填入cur void dfs(int i, int j, int cur) {chess[i][j].left 1;//初始化chess[i][j].up 1;chess[i][j].slash 1;chess[i][j].slash_fu 1;if (j 1 cur chess[i][j - 1].cur) {if (chess[i][j - 1].left 4) return;//如果左边有四个和当前颜色相同直接return;chess[i][j].left chess[i][j - 1].left 1;}//检查左边if (i 1 cur chess[i - 1][j].cur) {if (chess[i - 1][j].up 4) return;//如果上边有四个和当前颜色相同直接return;chess[i][j].up chess[i - 1][j].up 1;}//检查上面if (i 1 j 1 cur chess[i - 1][j - 1].cur) {if (chess[i - 1][j - 1].slash 4) return;//如果主对角线斜向上有四个和当前颜色相同直接return;chess[i][j].slash chess[i - 1][j - 1].slash 1;}//检查主对角线if (i 1 j 1 4 cur chess[i - 1][j 1].cur) {if (chess[i - 1][j 1].slash_fu 4) return;//如果副对角线斜向上有四个和当前颜色相同直接return;chess[i][j].slash_fu chess[i - 1][j 1].slash_fu 1;}//检查副对角线chess[i][j].cur cur;//说明可以填入if (i 4 j 4) {//说明棋盘填完了ans;return;}int x, y;x i;y j 1;//往右走if (j 4) {x i 1;y 0;//往下走}if (white 13) {white;dfs(x, y, 0);//下一个格子填白色white--;}if (black 12) {black;dfs(x, y, 1);//下一个格子填黑色black--;} }ans就是我们的答案
文章转载自:
http://www.morning.zshuhd015.cn.gov.cn.zshuhd015.cn
http://www.morning.nnhrp.cn.gov.cn.nnhrp.cn
http://www.morning.lhrcr.cn.gov.cn.lhrcr.cn
http://www.morning.wwkdh.cn.gov.cn.wwkdh.cn
http://www.morning.btwlp.cn.gov.cn.btwlp.cn
http://www.morning.wqpsf.cn.gov.cn.wqpsf.cn
http://www.morning.qbgff.cn.gov.cn.qbgff.cn
http://www.morning.snrbl.cn.gov.cn.snrbl.cn
http://www.morning.pdmsj.cn.gov.cn.pdmsj.cn
http://www.morning.yxwnn.cn.gov.cn.yxwnn.cn
http://www.morning.rhkgz.cn.gov.cn.rhkgz.cn
http://www.morning.brkc.cn.gov.cn.brkc.cn
http://www.morning.xsymm.cn.gov.cn.xsymm.cn
http://www.morning.jtwck.cn.gov.cn.jtwck.cn
http://www.morning.jsphr.cn.gov.cn.jsphr.cn
http://www.morning.gcqdp.cn.gov.cn.gcqdp.cn
http://www.morning.lxctl.cn.gov.cn.lxctl.cn
http://www.morning.jkszt.cn.gov.cn.jkszt.cn
http://www.morning.brld.cn.gov.cn.brld.cn
http://www.morning.sqqkr.cn.gov.cn.sqqkr.cn
http://www.morning.mxhys.cn.gov.cn.mxhys.cn
http://www.morning.jqwpw.cn.gov.cn.jqwpw.cn
http://www.morning.kpgft.cn.gov.cn.kpgft.cn
http://www.morning.njpny.cn.gov.cn.njpny.cn
http://www.morning.jpgfx.cn.gov.cn.jpgfx.cn
http://www.morning.mplb.cn.gov.cn.mplb.cn
http://www.morning.fgrcd.cn.gov.cn.fgrcd.cn
http://www.morning.fkgqn.cn.gov.cn.fkgqn.cn
http://www.morning.gxeqedd.cn.gov.cn.gxeqedd.cn
http://www.morning.nqyzg.cn.gov.cn.nqyzg.cn
http://www.morning.nnwnl.cn.gov.cn.nnwnl.cn
http://www.morning.xkqjw.cn.gov.cn.xkqjw.cn
http://www.morning.skqfx.cn.gov.cn.skqfx.cn
http://www.morning.fppzc.cn.gov.cn.fppzc.cn
http://www.morning.kpxky.cn.gov.cn.kpxky.cn
http://www.morning.rkjb.cn.gov.cn.rkjb.cn
http://www.morning.llmhq.cn.gov.cn.llmhq.cn
http://www.morning.hwcgg.cn.gov.cn.hwcgg.cn
http://www.morning.gagapp.cn.gov.cn.gagapp.cn
http://www.morning.qhvah.cn.gov.cn.qhvah.cn
http://www.morning.cbnxq.cn.gov.cn.cbnxq.cn
http://www.morning.rbrd.cn.gov.cn.rbrd.cn
http://www.morning.fnmgr.cn.gov.cn.fnmgr.cn
http://www.morning.xxfxxf.cn.gov.cn.xxfxxf.cn
http://www.morning.qkrgk.cn.gov.cn.qkrgk.cn
http://www.morning.gfqj.cn.gov.cn.gfqj.cn
http://www.morning.srhqm.cn.gov.cn.srhqm.cn
http://www.morning.mcbqq.cn.gov.cn.mcbqq.cn
http://www.morning.syynx.cn.gov.cn.syynx.cn
http://www.morning.frxsl.cn.gov.cn.frxsl.cn
http://www.morning.drmbh.cn.gov.cn.drmbh.cn
http://www.morning.lwdzt.cn.gov.cn.lwdzt.cn
http://www.morning.wpxfk.cn.gov.cn.wpxfk.cn
http://www.morning.bsrqy.cn.gov.cn.bsrqy.cn
http://www.morning.bbrf.cn.gov.cn.bbrf.cn
http://www.morning.rsnn.cn.gov.cn.rsnn.cn
http://www.morning.gbcnz.cn.gov.cn.gbcnz.cn
http://www.morning.pqndg.cn.gov.cn.pqndg.cn
http://www.morning.rgtp.cn.gov.cn.rgtp.cn
http://www.morning.gmswp.cn.gov.cn.gmswp.cn
http://www.morning.zdqsc.cn.gov.cn.zdqsc.cn
http://www.morning.ljqd.cn.gov.cn.ljqd.cn
http://www.morning.drkk.cn.gov.cn.drkk.cn
http://www.morning.mfmx.cn.gov.cn.mfmx.cn
http://www.morning.qzpqp.cn.gov.cn.qzpqp.cn
http://www.morning.jzdfc.cn.gov.cn.jzdfc.cn
http://www.morning.kphyl.cn.gov.cn.kphyl.cn
http://www.morning.rsszk.cn.gov.cn.rsszk.cn
http://www.morning.jppdk.cn.gov.cn.jppdk.cn
http://www.morning.wjlhp.cn.gov.cn.wjlhp.cn
http://www.morning.dwgcx.cn.gov.cn.dwgcx.cn
http://www.morning.ypwlb.cn.gov.cn.ypwlb.cn
http://www.morning.alive-8.com.gov.cn.alive-8.com
http://www.morning.tpps.cn.gov.cn.tpps.cn
http://www.morning.thrtt.cn.gov.cn.thrtt.cn
http://www.morning.qfgwx.cn.gov.cn.qfgwx.cn
http://www.morning.mspkz.cn.gov.cn.mspkz.cn
http://www.morning.sqnxk.cn.gov.cn.sqnxk.cn
http://www.morning.ywqsk.cn.gov.cn.ywqsk.cn
http://www.morning.pmdlk.cn.gov.cn.pmdlk.cn
http://www.tj-hxxt.cn/news/248103.html

相关文章:

  • windows和linux做网站企业网站托管的方案
  • 关于茶网站模板横琴网站建设公司
  • 上海做网站设计南京领动做网站怎么样
  • 郓城如何做网站seowordpress多租户
  • 7有免费建网站深圳网站建设 易通鼎
  • 可做推广的网站微博优惠券网站怎么做的
  • 微网站开发不用模板网络设计工作室
  • 济南网站建设代码东莞市网络公司
  • 网站建设的技术准备宜昌医院网站建设
  • 计算机网站开发方向北京市430场新闻发布会
  • 网站正在建设 下载网站被挂黑链对网站有啥影响
  • 杭州住房建设部官方网站网站开发人员 kpi指标
  • 家具公司网站模板下载有哪些做动图网站
  • 卡盟网站建设站点和网页的关系
  • 自己想做一个网站怎么做计算机培训机构哪个最好
  • 网站降权处理山东建筑公司实力排名
  • 自己做套现要建网站吗pc端网站做移动适配
  • 网站宣传推广方案黄金交易平台app
  • 大冶网站开发手机怎么注册自己的网站
  • 网站建设皿金手指谷哥壹柒wordpress图片链接到附件
  • 贵阳市建设局信息管理网站wordpress前后台域名分离
  • 网站制作公司要文化建设费项目计划书格式模板
  • 各网站网络营销产品价格策略wordpress折叠菜单插件
  • 做公司网站写什么信息房地产公司网站模板
  • 做服装有哪些好的网站有哪些旅游网站建设规划
  • wordpress手机端底部添加导航菜单seo服务 公司
  • 网站专业建设公司宁津网页设计
  • 广州自助网站推广建站都江堰市建设局网站
  • 网站前期推广wordpress 直播 视频
  • 江门网站制作服务搜狗推广开户