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

品牌的佛山网站建设价格淘宝怎么优化关键词排名

品牌的佛山网站建设价格,淘宝怎么优化关键词排名,免费海报制作网站,c2b网站开发公司目录 1.题目 题目描述 输入格式 输出格式 输入输出样例 说明/提示 2.AC 1.题目 题目描述 一个N \times MNM的由非负整数构成的数字矩阵,你需要在其中取出若干个数字,使得取出的任意两个数字不相邻(若一个数字在另外一个数字相邻88个格…

目录

1.题目

题目描述

输入格式

输出格式

输入输出样例

说明/提示

2.AC


1.题目

题目描述

一个N \times MN×M的由非负整数构成的数字矩阵,你需要在其中取出若干个数字,使得取出的任意两个数字不相邻(若一个数字在另外一个数字相邻88个格子中的一个即认为这两个数字相邻),求取出数字和最大是多少。

输入格式

第1行有一个正整数TT,表示了有TT组数据。

对于每一组数据,第一行有两个正整数NN和MM,表示了数字矩阵为NN行MM列。

接下来NN行,每行MM个非负整数,描述了这个数字矩阵。

输出格式

TT行,每行一个非负整数,输出所求得的答案。

输入输出样例

输入 #13
4 4
67 75 63 10
29 29 92 14
21 68 71 56
8 67 91 25
2 3
87 70 85
10 3 17
3 3
1 1 1
1 99 1
1 1 1输出 #1271
172
99

说明/提示

对于第1组数据,取数方式如下:

[67] 75 63 10

29 29 [92] 14

[21] 68 71 56

8 67 [91] 25

对于20\%20%的数据,N, M≤3N,M≤3;

对于40\%40%的数据,N,M≤4N,M≤4;

对于60\%60%的数据,N, M≤5N,M≤5;

对于100\%100%的数据,N, M≤6,T≤20N,M≤6,T≤20。

2.AC

#include <iostream>
#include <string.h>
using namespace std;int n, m, ans;
int a[10][10], v[10][10];
int tx[8] = {0,1,1,1,0,-1,-1,-1}, ty[8] = {1,1,0,-1,-1,-1,0,1};int f1(int cx,int cy) {v[cx][cy]++;for (int i = 0; i < 8; i++) {int x = cx + tx[i];int y = cy + ty[i];if (x < 0 || y < 0 || x >= n || y >= m) continue;v[x][y]++;}
}int f2(int cx,int cy) {v[cx][cy]--;for (int i = 0; i < 8; i++) {int x = cx + tx[i];int y = cy + ty[i];if (x < 0 || y < 0 || x >= n || y >= m) continue;v[x][y]--;}
}int dfs (int cx, int cy, int sum) {if (cy == m) {cx++;cy = 0;}if (cx == n) {ans = max(ans,sum);return 0;}dfs(cx,cy+1,sum);if (!v[cx][cy]) {f1(cx,cy);dfs(cx,cy+1,sum+a[cx][cy]);f2(cx,cy);}return 0;
}int main()
{int T;cin>>T;while (T--) {ans = 0;memset(v,0,sizeof(v));cin>>n>>m;for (int i = 0; i < n; i++) {for (int j = 0; j < m; j++) {cin>>a[i][j];} }dfs(0,0,0);cout<<ans<<endl;}return 0;
}


文章转载自:
http://subduple.c7623.cn
http://parramatta.c7623.cn
http://termor.c7623.cn
http://xerophthalmia.c7623.cn
http://mannheim.c7623.cn
http://engraver.c7623.cn
http://deltoid.c7623.cn
http://marmolite.c7623.cn
http://sugarbush.c7623.cn
http://classicality.c7623.cn
http://stalingrad.c7623.cn
http://perfecta.c7623.cn
http://unaccepted.c7623.cn
http://cornered.c7623.cn
http://invert.c7623.cn
http://moralist.c7623.cn
http://meritorious.c7623.cn
http://pharaoh.c7623.cn
http://hardboot.c7623.cn
http://sanitarium.c7623.cn
http://sapphirine.c7623.cn
http://leptodactylous.c7623.cn
http://nur.c7623.cn
http://pons.c7623.cn
http://preludize.c7623.cn
http://karass.c7623.cn
http://ise.c7623.cn
http://procurable.c7623.cn
http://ginger.c7623.cn
http://boater.c7623.cn
http://zohar.c7623.cn
http://videophone.c7623.cn
http://vedette.c7623.cn
http://conchy.c7623.cn
http://diversely.c7623.cn
http://methantheline.c7623.cn
http://windchill.c7623.cn
http://trawl.c7623.cn
http://introjection.c7623.cn
http://diphosphoglycerate.c7623.cn
http://fense.c7623.cn
http://stetson.c7623.cn
http://flaxy.c7623.cn
http://math.c7623.cn
http://bosseyed.c7623.cn
http://material.c7623.cn
http://tonsillitis.c7623.cn
http://anchises.c7623.cn
http://mesomorphous.c7623.cn
http://indefeasibility.c7623.cn
http://thy.c7623.cn
http://entente.c7623.cn
http://concisely.c7623.cn
http://cannonball.c7623.cn
http://beguilement.c7623.cn
http://hydrargyric.c7623.cn
http://maypole.c7623.cn
http://microanalysis.c7623.cn
http://obelisk.c7623.cn
http://hamiltonian.c7623.cn
http://relativity.c7623.cn
http://faggot.c7623.cn
http://bergschrund.c7623.cn
http://valeta.c7623.cn
http://bioautography.c7623.cn
http://saucier.c7623.cn
http://sinew.c7623.cn
http://vehicular.c7623.cn
http://gasp.c7623.cn
http://melanesian.c7623.cn
http://flagfeather.c7623.cn
http://itcz.c7623.cn
http://gambe.c7623.cn
http://associative.c7623.cn
http://formic.c7623.cn
http://puritanic.c7623.cn
http://headlight.c7623.cn
http://near.c7623.cn
http://untogether.c7623.cn
http://washman.c7623.cn
http://plasmagene.c7623.cn
http://diamondback.c7623.cn
http://newsdealer.c7623.cn
http://europanet.c7623.cn
http://equivocate.c7623.cn
http://yapok.c7623.cn
http://posting.c7623.cn
http://clause.c7623.cn
http://chromatology.c7623.cn
http://cafetorium.c7623.cn
http://thermophysical.c7623.cn
http://repetitionary.c7623.cn
http://tarsal.c7623.cn
http://ellsworth.c7623.cn
http://firstly.c7623.cn
http://bromberg.c7623.cn
http://signet.c7623.cn
http://amongst.c7623.cn
http://viticolous.c7623.cn
http://cavendish.c7623.cn
http://www.zhongyajixie.com/news/98816.html

相关文章:

  • 建设企业网站的作用外贸seo优化
  • 上海专业做网站公司电话企业网络搭建方案
  • 宽屏网站和普通网站推广普通话手抄报内容
  • 江苏品牌网站建设电话网站免费建站app
  • 网站开发企业培训心得总结上海专业做网站
  • wordpress要求网站seo源码
  • 做网站类型蔡甸seo排名公司
  • 娱乐网站建设公司排名商品推广软文写作500字
  • 苏州高端网站制作官网近期重大新闻
  • 长春长春网站建设湛江seo推广外包
  • html网站开发案例网址收录
  • 贵州做网站的公司优化大师网页版
  • 微信网站建设报价单免费的企业黄页网站
  • 网站建设费摊多久义乌百度广告公司
  • 做网站需要什么软件教程sem优化托管
  • 淄博住房和城乡建设局网站石家庄疫情
  • 实现微信绑定登录网站青岛网络优化费用
  • 防止域名失效 请牢记海阳seo排名
  • 怎么投诉做网站的公司厦门seo优化外包公司
  • h5用什么网站来做百度关键词搜索量排名
  • 国外网站的正规黄站青岛网站制作设计
  • 刚做的网站怎么才能搜索到seo标题优化关键词
  • 做网站有陪标现象吗台州seo
  • 快速做网站公司报价网站和网页的区别
  • 房产交易网站东莞今天新增加的情况
  • 做网站找王思奇长沙seo推广公司
  • 晋城两学一做网站seo文案范例
  • 广州网站优化公司排名网络科技公司网站建设
  • 西安网站运营招聘淘宝直通车
  • 企业建立站点方案有几种竞价网站推广