摘要: 题意:一段数字,逆置其中两个使其递增DescriptionBeing a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of ndisti... 阅读全文
posted @ 2015-02-09 09:20 江豚 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题意及题解:判断有存在几个后面的数比前面的小;如果没有则输出0;如果有不止一个,则输出-1;如果恰有一个, 那么就需要判断a[1]和a[n]的大小关系。DescriptionOne day, Twilight Sparkle is interested in how to sort a sequen... 阅读全文
posted @ 2015-02-08 21:13 江豚 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 题意:给n 求最小的x题解:二元一次方程求解,x*x+x*b-n=0 遍历bDescriptionLet's consider equation:x^2 + s(x)·x - n = 0, where x, n are positive integers, s(x) is the function,... 阅读全文
posted @ 2015-02-08 21:07 江豚 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 题意:求平均值,注意精度A number of students are members of a club that travels annually to exotic locations. Their destinations in the past have included Indiana... 阅读全文
posted @ 2015-02-08 21:01 江豚 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 题意:求平均每千米花的时间,注意精度和格式DescriptionA relay is a race for two or more teams of runners. Each member of a team runs one section of the race. Your task is t... 阅读全文
posted @ 2015-02-08 20:58 江豚 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 题意 男女匹配,最多组合数题解 匈牙利算法Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个... 阅读全文
posted @ 2015-02-07 12:36 江豚 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 题解:dpDescriptionAlex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game a... 阅读全文
posted @ 2015-02-03 20:53 江豚 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 题意 :求期望题解 :找规律,列举几个,然后找到规律。坑点:要简化,不简化数字一大就wa了Sample InputInput6 1Output3.500000000000Input6 3Output4.958333333333Input2 2Output1.750000000000HintConsi... 阅读全文
posted @ 2015-02-03 20:25 江豚 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 题意:Sample Input4 6 4 3 2 2 1 15 3 2 1 1400 12 50 50 50 50 50 50 25 25 25 25 25 250 0 Sample OutputSums of 4:43+12+22+1+1Sums of 5:NONESums of 400:50+5... 阅读全文
posted @ 2015-02-03 11:10 江豚 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 题解 最小生成树 prim算法Problem Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成... 阅读全文
posted @ 2015-02-02 21:56 江豚 阅读(127) 评论(0) 推荐(0) 编辑