上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 27 下一页
摘要: gcd int gcd(int a,int b)///辗转相除法求最大公约数 { int t = a; while(a%b) { a=b; b=t%b; t=a; } return b; } View Code 或者 int gcd(int a, int b) { return b == 0 ? a 阅读全文
posted @ 2020-10-07 20:41 然终酒肆 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef struct LinkNode 4 { 5 int data; 6 LinkNode* next; 7 }LinkNode; 8 LinkNode *InitList() //创建空 阅读全文
posted @ 2020-10-03 11:30 然终酒肆 阅读(380) 评论(0) 推荐(0) 编辑
摘要: 本质上字符串这种题都可以暴力穷举 但是还是要用更好的算法试试 我开始没有想到这是一道可以用动态规划解决的问题 1 class Solution { 2 public: 3 string longestPalindrome(string s) { 4 int n = s.size(); 5 vecto 阅读全文
posted @ 2020-10-03 10:53 然终酒肆 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 并不是很难 因为完全可以暴力去做 也可以参照kmp 但是我要说的是 这种题也可以用很经典得到滑动窗口 1 class Solution { 2 public: 3 int lengthOfLongestSubstring(string s) { 4 // 哈希集合,记录每个字符是否出现过 5 uno 阅读全文
posted @ 2020-10-03 10:29 然终酒肆 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 int minimumOperations(string leaves) { 4 int n = leaves.size(); 5 vector<vector<int>> f(n, vector<int>(3)); 6 f[0][0] = 阅读全文
posted @ 2020-10-03 00:51 然终酒肆 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 int w[1001],v[100003],f[1001]={0}; 4 int main() 5 { 6 int m,n; 7 scanf("%d %d",&m,&n); //m容量 n种药材 8 阅读全文
posted @ 2020-10-01 23:15 然终酒肆 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-10-01 22:56 然终酒肆 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <string> 3 #include <stdio.h> 4 #include <cmath> 5 #include <algorithm> 6 using namespace std; 7 8 bool judge(string 阅读全文
posted @ 2020-09-30 12:43 然终酒肆 阅读(268) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/msymm/articles/9917089.html 阅读全文
posted @ 2020-09-30 11:13 然终酒肆 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 1 #include <cstdio> 2 #include <set> 3 #include <iostream> 4 #include <cstring> 5 using namespace std; 6 7 8 9 int main() 10 { 11 int n, i, cnt = 0;in 阅读全文
posted @ 2020-09-30 10:29 然终酒肆 阅读(250) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 27 下一页