当前位置: 首页 > 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.zqtcl.cn/news/756205/

相关文章:

  • 简洁网站模板素材用wordpress上传源砖
  • 高密做网站电影html网页模板设计素材
  • 湖北网络营销网站襄阳网站建设-飞鱼网络
  • 想更新公司网站怎么做关于网站开发的自我评价
  • 找建筑工作哪个网站好新增网站 备案
  • 格力网站的建设情况wordpress mysql 密码重置
  • 网站access数据怎么做高端品牌网站建设的目的
  • 外贸买家网站凯里网站建设流程
  • 网站一年要多少钱国外的建筑设计网站
  • 手游发号网站模板ic外贸网站建设
  • 珠海网站制作案例tp5 商城网站开发
  • 母婴用品网站建设规划上海市建设工程 安全协会网站
  • 做室内设计特别好的网站网站服务器租用恒创
  • 慕课网站开发文档wordpress上传到空间
  • 行业垂直网站开发漳州最便宜的网站建设价格
  • 高级网站设计效果图网站设计制作哪些
  • 惠山区住房和建设厅网站营销推广方式都有哪些
  • 做网贷网站多少钱wordpress首页短代码
  • 网站网格湖南网页
  • 做网站的知名品牌公司用ps切片做网站
  • 中学网站模板下载番禺外贸网站建设
  • 常州网站seo代理加盟郑州浩方网站建设智联招聘
  • 小型网站制作网站开发做什么费用
  • seo网站论文社交app开发公司
  • 企业宣传网站建设图示《高性能网站建设》
  • 福州志愿者官方网站怎么做erp管理系统介绍
  • 高端网站建设费用情况广州开发区控股集团有限公司
  • 精湛的网站设计云南网招聘
  • 南昌网站建设公司行情Wordpress添加分页按钮
  • 论坛网站建设流程wordpress速度优化插件