- 博客(5)
- 收藏
- 关注
原创 5. Longest Palindromic Substring
方法#1 (围绕中心扩展)注意到回文字符串是围绕中心对称的。当长度为奇数时时以中间字符为轴,长度为偶数时以中间缝隙为轴。设字符串s , j 为某字符的索引。以 s[j] 为中心向两边扩展时,如果 s[j+1]==s[j] , j++,相当于变为长度为偶数的扩展 。string longestPalindrome(string s){ if(s.size()<=1) return
2018-04-05 20:45:29
152
原创 1.操作系统的启动
一些概念:扇区:计算机读取硬盘的时候,不是一个字节一个字节的读取,而是一次读取512字节。每512个字节就称为一个扇区。启动程序IPL:操作系统的大小远超过512个字节,而且不固定。所以在硬盘的第一个扇区中放入一个启动程序,其主要作用就是加载硬盘中的操作系统到内存。这个启动程序就是BootLoader。几乎所有的操作系统都把加载自己的程序放在硬盘的第一个扇区。BIOS:基本IO处理系统程序,开始时...
2018-04-04 19:01:13
466
原创 4. Median of Two Sorted Arrays(二分查找)
Description:There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Discuss:参考本题排名第一的...
2018-04-03 23:13:49
3710
原创 PAT 1114 Family Property (并查集)
#include<iostream>#include<algorithm>#include<vector>#include<set>using namespace std;#define m 10000int road[m],n;struct item{//先合并item,才能统计 int id,h,area;}d[1010];i...
2018-03-10 23:30:27
216
原创 PAT 1045. Favorite Color Stripe (动态规划)
#includeusing namespace std;#define m 210int dp[m]={0};//以colorindex结尾的,最长的序列的长度int index[m]={0};//color在color sequence中的索引int main(){ int n,k,lim,t,ans=0; cin>>lim>>k; for (int i = 1; i <= k;
2018-03-10 15:56:06
182
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人