- 博客(5)
- 收藏
- 关注
原创 1089. Insert or Merge (25)
IEDA 1.此题不是insertion sort就是merge sort。 2.insertion sort容易判断,根据定义,insertion sort插入的数据是有序的,所以找出序列中第一个使得子序列未有序的数字,判断从该数开始到结束,所有数字是否与原给定的待排序数一致,若一致,则可以判定为insertion sort。接下来要做的就是在进行一次排序,将刚找出的数字与前面有序子序列进行
2016-08-30 09:38:41 303
原创 1045. Favorite Color Stripe (3
IDEA 1.本题是求最长连续子串,但是相同子串允许重复出现 2.采用动态规划方法,将动态表表示最大出现长度 2 2 4 1 5 5 6 3 1 1 5 6 0 0 0 0 0 0 0 0 0 0 0
2016-08-29 10:13:11 527
原创 1048. Find Coins (25)
IDEA 1.注意题目给的数字范围的大小,m 2.从1-m/2遍历即可,不用遍历到m CODE #include #include #include using namespace std; #define MAX 1001 int main(){ #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); #endif
2016-08-28 09:32:27 328
原创 1009. Triple Inversions (35)
IDEA 1.使用树状数组求逆序数的问题,参考 http://wenku.baidu.com/view/8251fc0516fc700abb68fc76.html?re=view 点击打开链接 2.以中间数为基准,算出左边比其大的数个数,右边比其小的数个数,二者相乘得出结果 3.结果用long long表示 CODE #include #include #include #in
2016-08-27 10:29:34 501
原创 1010. Lehmer Code (35)
注意!!!综合拼凑!!! 本题用到几个知识点 1.树状数组,和其算法lowbit,sum 2.逆序数 3.将数值差距较大的数组按大小顺序映射到1-n区间内 #include #include #include #include #include using namespace std; struct Node{ int id; int val; }; int n; int
2016-08-26 12:03:02 605
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人