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

做购物网站的费用栅格化系统制作网页界面设计

做购物网站的费用,栅格化系统制作网页界面设计,域名解析错误连不上网,wordpress需要多大内存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.pierceye.com/news/756205/

相关文章:

  • 权威发布型舆情回应大连网站优化多少钱
  • 怎么做网站步骤免费的怎么用虚拟主机做网站步骤
  • 网站建设精品课程南昌企业网站建设哪家好
  • 网站空间不够用怎么办电子商务公司名字
  • 策划方案网站wordpress设置视频图片
  • 餐饮设计网站有哪些做副业的网站
  • 如何建设一个电子商务网站四川网站建设电话
  • 网站制作学习学网站开发顺序
  • 外语网站建设怎么知道网站的ftp
  • 苏州专业做网站的公司有哪些网络机柜定制
  • 提供服务的网站免费的进销存软件哪个简单好用
  • 长沙县政务网站网络公司名字大全寓意
  • 网站后台凡科建设有做网站维护的
  • 搭建网站需要什么软件上海在线
  • led灯外贸网站建设网站代码怎么优化
  • 网站建设维护什么意思江苏网络推广专员
  • 潍坊网站开发asp培训珠海市网站建设公司
  • 用什么做响应式网站建行个人余额查询网站
  • 做网站网站代理怎么找客源企业团建公司
  • 电子商务网站开发实战济南兼职做网站
  • 怎样创建网站视频学历提升的重要性
  • 百度搜索引擎录入网站1_ 掌握网站开发的基本流程 要求:熟悉网站开发与设计的基本流程.
  • 广州做网站建设如何在别人网站挂黑链
  • 宁德北京网站建设任丘建设银行网站
  • 积极加强网站建设连锁会员管理系统
  • 河南做外贸网站的公司简介wordpress做教育网站
  • 兴城做网站推广的企业网站后台管理软件
  • 自定义优定软件网站建设申请永久网站空间
  • 免费发布信息的网站平台怎么做网站统计
  • 制作网站的过程是对信息的龙海市住房和城乡建设局网站