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

网站链接可以自己做吗上海火迎网络推广运营优化

网站链接可以自己做吗,上海火迎网络推广运营优化,软件开发培训学校软件开发培训机构,网站制作多少钱资讯题意#xff1a; 给你一个矩阵#xff0c;问你按照象棋马的走法#xff0c;下一步比上一步的数大#xff0c;问长度最长的序列是多长#xff0c;然后输出序列。如果有多个最长序列输出字典序最小的那个。类似滑雪#xff0c;找出最长路径#xff0c;多个答案 输出字典序…题意 给你一个矩阵问你按照象棋马的走法下一步比上一步的数大问长度最长的序列是多长然后输出序列。如果有多个最长序列输出字典序最小的那个。类似滑雪找出最长路径多个答案 输出字典序最小的。 思路 将矩阵上的数字从大到小排序贪心找路径。。 题目 The cows have revised their game of leapcow. They now play in the middle of a huge pasture upon which they have marked a grid that bears a remarkable resemblance to a chessboard of N rows and N columns (3 N 365).  Heres how they set up the board for the new leapcow game:  * First, the cows obtain N x N squares of paper. They write the integers from 1 through N x N, one number on each piece of paper.  * Second, the number cow places the papers on the N x N squares in an order of her choosing.  Each of the remaining cows then tries to maximize her score in the game.  * First, she chooses a starting square and notes its number.  * Then, she makes a knight move (like the knight on a chess board) to a square with a higher number. If shes particularly strong, she leaps to the that square; otherwise she walks.  * She continues to make knight moves to higher numbered squares until no more moves are possible.  Each square visited by the knight earns the competitor a single point. The cow with the most points wins the game.  Help the cows figure out the best possible way to play the game. Input * Line 1: A single integer: the size of the board * Lines 2.. ...: These lines contain space-separated integers that tell the contents of the chessboard. The first set of lines (starting at the second line of the input file) represents the first row on the chessboard; the next set of lines represents the next row, and so on. To keep the input lines of reasonable length, when N 15, a row is broken into successive lines of 15 numbers and a potentially shorter line to finish up a row. Each new row begins on its own line.  Output * Line 1: A single integer that is the winning cows score; call it W.  * Lines 2..W1: Output, one per line, the integers that are the starting square, the next square the winning cow visits, and so on through the last square. If a winning cow can choose more than one path, show the path that would be the smallest if the paths were sorted by comparing their respective square numbers.  Sample Input 4 1 3 2 16 4 10 6 7 8 11 5 12 9 13 14 15 Sample Output 7 2 4 5 9 10 12 13 #includestdio.h #includestring.h #includealgorithm using namespace std; #define inf 0x3f3f3f3f const int M400; int pre[M][M],dp[M][M],w[M][M],m;/*w在该点走到不能再走走了多少步,pre记录路径*/ int e[8][2]{2,1,1,2,-1,-2,-2,-1,1,-2,-1,2,2,-1,-2,1};/*记忆化暴力care字典序*/ struct node {int x,y,z;bool operator(const node tt)const//sort默认为从大到小排序优先队列默认为从小到大。{return tt.zz;} }s[M*M];/*care*/ int main() {while(~scanf(%d,m)){int k0;for(int i0;im;i)for(int j0;jm;j){scanf(%d,dp[i][j]);s[k].xi;s[k].yj;s[k].zdp[i][j];}sort(s,sk);/*由大到小找便于输出记录的路径最后记录的是起始点的坐标需要注意字典序*/int ans-1,a,b,ccinf;for(int i0;ik;i)/*遍历每一个点作为起始点因为该点以前点都是比该点小大的只能往前走*/{int ma-1,ant,mi;for(int j0;j8;j){int us[i].xe[j][0],vs[i].ye[j][1];if(u0||v0||um||vm)continue;if(maw[u][v]||(maw[u][v]antdp[u][v]))//一方面是控制字典序另一方面走一步越小可能走的步数越多{maw[u][v];antdp[u][v];mij;}}w[s[i].x][s[i].y]ma1;pre[s[i].x][s[i].y]mi;if(ansma1||(ansma1ccdp[s[i].x][s[i].y]))/*控制字典序*/{ccdp[s[i].x][s[i].y];ansma1;as[i].x;bs[i].y;}}printf(%d\n,ans);for(int i1;ians;i){printf(%d\n,dp[a][b]);int kkpre[a][b];ae[kk][0];be[kk][1];}}return 0; }
http://www.zqtcl.cn/news/444741/

相关文章:

  • 网站测评必须做灯笼制作手工简单又漂亮
  • 购物网站建设的意义与目的wordpress 插件 加速
  • 大型html5浅蓝色网站设计公司dede模板网店怎么开店详细教程
  • 一个阿里云怎么做两个网站吗樱花16q808a
  • 如何利用服务器做网站网站建设朝阳
  • 比邻店网站开发企查查企业信息查询在线
  • 家乡网站建设策划案专业建设专题网站
  • 网站建设公司挣钱吗wordpress评论内容密码保护
  • 上海专业建站最低价网站程序模板
  • 蚌埠网站建设哪家好创客贴官网
  • php网站建设参考文献wordpress 头像 很慢
  • 大连seo网站推广phpcmsv9手机网站源码
  • 公司做推广做网站好还是俄文网站引擎
  • 上海市建设咨询协会网站asp网站源码
  • 大家都在哪些网站上做医药招商wordpress po文件
  • 国外主题网站兰州app
  • 建设项目自主验收公示网站dedecms英文外贸网站企业模板下载
  • 做网站要服务器吗前端企业网站开发
  • 用html写一个个人介绍多网站怎么做seo
  • 做网站打广告犯法吗中国建设投资集团 网站首页
  • 怎么免费申请个人网站职业技能培训有哪些
  • 小型的企业网站湖南备案网站建设方案书
  • 现在做网站公司seo怎么做教程
  • asp化妆品网站windows优化大师有必要安装吗
  • 网站流量分析系统制作图片网站
  • 做网站技术路线广州番禺发布公众号
  • 企业网站自己可以做吗服装网站建设的利益分析
  • 网站做软件居众装饰集团有限公司
  • 南山网站制作联系电话芒果国际影城星沙店
  • 珠海网站设计费用建企业版网站多久