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

建设网站项目总结物联网卡一年服务费多少钱啊

建设网站项目总结,物联网卡一年服务费多少钱啊,杭州设计师网站,做问卷用哪个网站好hdoj 1052 Tian Ji -- The Horse Racing【田忌赛马】 【贪心】思路#xff1a;先按从小到大排序#xff0c; 然后从最快的开始比(假设i#xff0c; j 是最慢的一端#xff0c; flag1#xff0c; flag2是最快的一端 )#xff0c;田的最快的大于king的 则比较#xff0c;如…hdoj 1052 Tian Ji -- The Horse Racing【田忌赛马】 【贪心】思路先按从小到大排序 然后从最快的开始比(假设i j 是最慢的一端 flag1 flag2是最快的一端 )田的最快的大于king的 则比较如果等于然后判断有三种情况一大于则比较二等于在判断田的最慢的是不是比king的最快的慢三小于则与king的最快的比较Tian Ji -- The Horse RacingTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17266    Accepted Submission(s): 5015Problem DescriptionHere is a famous story in Chinese history.That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others.Both of Tian and the king have three horses in different classes, namely, regular, plus, and super. The rule is to have three rounds in a match; each of the horses must be used in one round. The winner of a single round takes two hundred silver dollars fromthe loser.Being the most powerful man in the country, the king has so nice horses that in each class his horse is better than Tians. As a result, each time the king takes six hundred silver dollars from Tian.Tian Ji was not happy about that, until he met Sun Bin, one of the most famous generals in Chinese history. Using a little trick due to Sun, Tian Ji brought home two hundred silver dollars and such a grace in the next match.It was a rather simple trick. Using his regular class horse race against the super class from the king, they will certainly lose that round. But then his plus beat the kings regular, and his super beat the kings plus. What a simple trick. And how do youthink of Tian Ji, the high ranked official in China?Were Tian Ji lives in nowadays, he will certainly laugh at himself. Even more, were he sitting in the ACM contest right now, he may discover that the horse racing problem can be simply viewed as finding the maximum matching in a bipartite graph. Draw Tianshorses on one side, and the kings horses on the other. Whenever one of Tians horses can beat one from the king, we draw an edge between them, meaning we wish to establish this pair. Then, the problem of winning as many rounds as possible is just to findthe maximum matching in this graph. If there are ties, the problem becomes more complicated, he needs to assign weights 0, 1, or -1 to all the possible edges, and find a maximum weighted perfect matching...However, the horse racing problem is a very special case of bipartite matching. The graph is decided by the speed of the horses --- a vertex of higher speed always beat a vertex of lower speed. In this case, the weighted bipartite matching algorithm is a tooadvanced tool to deal with the problem.In this problem, you are asked to write a program to solve this special case of matching problem.InputThe input consists of up to 50 test cases. Each case starts with a positive integer n (n 1000) on the first line, which is the number of horses on each side. The next n integers on the second line are the speeds of Tian’s horses.Then the next n integers on the third line are the speeds of the king’s horses. The input ends with a line that has a single 0 after the last test case.OutputFor each input case, output a line containing a single number, which is the maximum money Tian Ji will get, in silver dollars.Sample Input392 83 7195 87 74220 2020 20220 1922 180Sample Output20000#include#includeusing std::sort;int cmp( int a, int b ){if( a b ) return true;return false;}int main(){int t[1005], k[1005], n, i, j, c;while( scanf( %d, n ), n ){c 0;for( i 0; i n; i )scanf( %d, t[i] );sort( t, tn, cmp );for( i 0; i n; i )scanf( %d, k[i] );sort( k, k n, cmp );i j 0;int flag1 n-1, flag2 n-1;//flag1是田的while( i flag1 ){if( t[flag1] k[flag2] ){c;--flag1;--flag2;}else if( t[flag1] k[flag2] ){if( t[i]k[j] ){c;i;j;}else if( t[i] k[j] ){if( t[i] k[flag2] ) --c; //注意这处wa了好几次i;--flag2;}else if( t[i] k[j] ){--c;i;--flag2;}}else{--c;i;--flag2;}}printf( %d\n, c*200 );}}
http://www.zqtcl.cn/news/813193/

相关文章:

  • 网站开发行业竞争大吗郑州百度推广代运营公司
  • mvc4做网站五设计一个公司网站多少钱
  • 在什么网站可以做外贸出口劳保鞋北京 代理前置审批 网站备案
  • 邢台建设企业网站房地产宣传推广方案
  • 建设机械网站案例分析餐饮vi设计开题报告范文
  • 做本地生活网站深圳建设工程信息网站
  • C2C电商网站做博客的网站有哪些
  • 住房和城乡建设部网站 事故安微省建设厅田网站
  • 百度一下你就知道官页淘宝seo搜索引擎优化
  • 网站平台维护phpwind做的网站
  • 网站怎么做移动适配怎么样才算是一个网站页面
  • 做pc端网站策划百度网站建立
  • 高级网站开发技术青岛网站建设方案服务
  • 深圳公司网站建设设房地产网址大全
  • 怎么里ip做网站女生学广告学后悔死了
  • 做西餐网站wordpress 作者栏
  • 创建了网站安卓做视频网站
  • asp自助建站系统房地产楼盘微信网站建设营销方案
  • 网站建设公司发展方向及趋势低代码小程序开发平台
  • 临沂网站建设企业响应式网站首页
  • 福州网上商城网站建设wordpress登录界面logo
  • 子目录网站wordpress无中断音乐插件
  • 网站开发算是研发支出吗淘宝客网站建设的策略
  • 如果在工商局网站上做股权质押刷推广链接的网站
  • 保定建站公司模板wordpress 华为云
  • 好的网页设计网站推荐开发定制软件公司
  • 深圳做网站设计多媒体网站开发
  • 什么是网站组件高端网站设计高端网站制作
  • 网易网站建设深圳专业营销网站制作
  • 有口碑的佛山网站建设东莞网约车资格证官网登录入口