摘要: DIV1 250pt题意:有很多袋子,里面装有苹果和橘子(也可能没有),给出每个袋子里有多少个苹果,多少个橘子。如果每个袋子里含有水果的总数都不小于x个,则可以从每个袋子里都拿出x个水果(拿出苹果和橘子的总数为x),将所有拿出的水果混合成一份礼物,问可能混合出的礼物的种数。 最多50个袋子,每个... 阅读全文
posted @ 2013-12-28 23:32 Plumrain 阅读(459) 评论(0) 推荐(0) 编辑
摘要: DIV1 250pt题意:称string s是vector words的ordered superstring,如果它满足:存在一个数列{x0, x1, x2...xm}(m = words.size()),使得words[i]与s中从xi开始的,长度为words[i].size()的字符串相同,且x0 12 #include 13 #include 14 #include 15 #include 16 #include 17 #include 18 #include 19 #include 20 #include 21 #include 22 #include 23 ... 阅读全文
posted @ 2013-12-28 23:01 Plumrain 阅读(267) 评论(0) 推荐(0) 编辑
摘要: DIV1 250pt题意:每天晚上需要点蜡烛,且每晚蜡烛燃烧1cm,第i天晚上需要点i根蜡烛。第一天白天的时候,拥有一些蜡烛,用vectorcan表示他们的长度,问最多能烧几个晚上。解法:模拟+贪心,每次烧长度最长的k支蜡烛即可。tag:simulation, greedy 1 // BEGIN CUT HERE 2 /* 3 * Author: plum rain 4 * score : 5 */ 6 /* 7 8 */ 9 // END CUT HERE 10 #line 11 "OlympicCandles.cpp" 11 #include 12 #inc... 阅读全文
posted @ 2013-12-28 13:18 Plumrain 阅读(216) 评论(0) 推荐(0) 编辑
摘要: DIV1 250pt题意:给定整数n和k,问最少需要多少个n连接在一起形成的新整数t,使得t是k的倍数。如果不能形成倍数,输出-1。k 12 #include 13 #include 14 #include 15 #include 16 #include 17 #include 18 #include 19 #include 20 #include 21 #include 22 #include 23 #include 24 #include 25 #include 26 #include 27 #include 28 #include 29 #includ... 阅读全文
posted @ 2013-12-28 02:36 Plumrain 阅读(142) 评论(0) 推荐(0) 编辑
摘要: DIV1 250pt题意:给两个'a'-'z'的字符串,是否存在一个'a'-'z'的置换,使得能将一个字符串转化成另一个字符串。解法:题意即是求,s1和s2对应位置出现的字符在原字符串中出现的次数和每次出现的位置是否一样。可以将s1和s2分别转化成一个数列,数列的相等与否 和 是否存在那样的置换是等价的。tag:think 1 // BEGIN CUT HERE 2 /* 3 4 */ 5 // END CUT HERE 6 #line 7 "IsomorphicWords.cpp" 7 #include 8 阅读全文
posted @ 2013-12-28 02:32 Plumrain 阅读(178) 评论(0) 推荐(0) 编辑