上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 21 下一页
摘要: 在一个由 0 和 1 组成的二维矩阵内,找到只包含 1 的最大正方形,并返回其面积。示例:输入: 1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0输出: 4算法:动态规划 阅读全文
posted @ 2019-07-20 13:41 YF-1994 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 回文串是指aba、abba、cccbccc、aaaa这种左右对称的字符串。每个字符串都可以通过向中间添加一些字符,使之变为回文字符串。 例如:abbc 添加2个字符可以变为 acbbca,也可以添加3个变为 abbcbba。方案1只需要添加2个字符,是所有方案中添加字符数量最少的。 现在,给定一个字 阅读全文
posted @ 2019-07-20 00:07 YF-1994 阅读(2476) 评论(0) 推荐(0) 编辑
摘要: 给出一个整数K和一个无序数组A,A的元素为N个互不相同的整数,找出数组A中所有和等于K的数对。例如K = 8,数组A:{-1,6,5,3,4,2,9,0,8},所有和等于8的数对包括(-1,9),(0,8),(2,6),(3,5)。 输入 第1行:用空格隔开的2个数,K N,N为A数组的长度。(2 阅读全文
posted @ 2019-07-19 20:59 YF-1994 阅读(438) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; #define N 1010 int dp[N][N]; char c; int main() { char a[N]; char b[N]; scanf("%s%s",a,b); int la=strlen(a); int lb=strlen... 阅读全文
posted @ 2019-07-19 20:00 YF-1994 阅读(525) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; bool cmp(string &s, string &t){ if(s.size()!=t.size())return s.size()>t.size(); for(int i=0;it[i]; } return true; } vector... 阅读全文
posted @ 2019-07-19 19:45 YF-1994 阅读(120) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int n; vector get_yue(int x){ vectorres; for(int i=1;i>n; for(int i=0,a;i>a; auto p=get_yue(a); for(auto x:p)cout<<x<<' ';... 阅读全文
posted @ 2019-07-19 14:06 YF-1994 阅读(216) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; const int N=10000001; int prim[N],cnt; bool st[N]; int primcnt(int n){ for(int i=2;i<=n;i++){ if(!st[i])prim[c 阅读全文
posted @ 2019-07-19 13:59 YF-1994 阅读(122) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int n; void get_prim(int x){ for(int i=2;i1)cout>n; for(int i=0,a;i>a; get_prim(a); } return 0; } 阅读全文
posted @ 2019-07-19 13:58 YF-1994 阅读(158) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int n; bool prim(int x){ if(x>n; for(int i=0,a;i>a; if(prim(a))cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; } 阅读全文
posted @ 2019-07-19 13:50 YF-1994 阅读(415) 评论(0) 推荐(0) 编辑
摘要: 输入一个长度为n的整数序列,从中找出一段长度不超过m的连续子序列,使得子序列中所有数的和最大。 输入格式 第一行输入两个整数n,m。 第二行输入n个数,代表长度为n的整数序列。 同一行数之间用空格隔开。 输出格式 输出一个整数,代表该序列的最大子序和。 数据范围 1≤n,m≤300000 输入样例: 阅读全文
posted @ 2019-07-18 18:04 YF-1994 阅读(133) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 21 下一页