上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页
摘要: 朴素的回文串做法1: 1 #include<bits/stdc++.h> 2 using namespace std; 3 string longestPailndrome(string &s){ 4 int Len = s.size(); //字符串长度 5 int MaxLen = 1; //最 阅读全文
posted @ 2019-08-27 11:28 Osea 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 【题目链接】 http://acm.hdu.edu.cn/showproblem.php?pid=6719 在本题中,我们只有两种方法计算两个的矩阵的乘积,第一种为定义法,需要次乘法和次加法。第二种为Strassen分治法,仅当为偶数时可以使用,需要次加法以及再计算次大小为的矩阵的乘积。这次更小矩阵 阅读全文
posted @ 2019-08-27 11:08 Osea 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 【P1464 Function】 【题解】 按照题目意思进行递归即可,但是过程中需要用到记忆化搜索。 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 ll dp[50][50][50]; 5 ll 阅读全文
posted @ 2019-08-27 09:38 Osea 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 【P3817 小A的糖果 小A有N个糖果盒,第i个盒中有a[i]颗糖果。 小A每次可以从其中一盒糖果中吃掉一颗,他想知道,要让任意两个相邻的盒子中加起来都只有x颗或以下的糖果,至少得吃掉几颗糖。 【贪心策略】: 因为吃后面的可以影响后面的情况。所以一旦不满足就吃后面的即可。 1 #include<b 阅读全文
posted @ 2019-08-27 08:34 Osea 阅读(316) 评论(0) 推荐(0) 编辑
摘要: 【P3662】[USACO17FEB]Why Did the Cow Cross the Road II S 求解连续的k个数的最大值,利用前缀和维护即可。 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N = 1e6+10 阅读全文
posted @ 2019-08-26 09:08 Osea 阅读(283) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给定一个只包含加法和乘法的算术表达式,请你编程计算表达式的值。 给定一个只包含加法和乘法的算术表达式,请你编程计算表达式的值。 输入格式 一行,为需要你计算的表达式,表达式中只包含数字、加法运算符“++”和乘法运算符“×”,且没有括号,所有参与运算的数字均为 0 到 2^{31}之间的整数 阅读全文
posted @ 2019-08-26 08:30 Osea 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 题目描述 MM 海运公司最近要对旗下仓库的货物进出情况进行统计。目前他们所拥有的唯一记录就是一个记录集装箱进出情况的日志。该日志记录了两类操作:第一类操作为集装箱入库操作,以及该次入库的集装箱重量;第二类操作为集装箱的出库操作。这些记录都严格按时间顺序排列。集装箱入库和出库的规则为先进后出,即每次出 阅读全文
posted @ 2019-08-26 08:24 Osea 阅读(301) 评论(0) 推荐(0) 编辑
摘要: Balance Scale 题目描述 You, an experimental chemist, have a balance scale and a kit of weights for measuring weights of powder chemicals.For work efficien 阅读全文
posted @ 2019-08-23 01:03 Osea 阅读(376) 评论(0) 推荐(0) 编辑
摘要: Prime-Factor Prime 题目描述 A positive integer is called a "prime-factor prime" when the number of its prime factors is prime. For example, 12 is a prime- 阅读全文
posted @ 2019-08-23 00:53 Osea 阅读(595) 评论(0) 推荐(0) 编辑
摘要: Tournament Chart 题目描述 In 21XX, an annual programming contest, Japan Algorithmist GrandPrix (JAG) has become one of the most popular mind sports events 阅读全文
posted @ 2019-08-23 00:51 Osea 阅读(245) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页