版本: v1.0 | 日期: 2026-04-18 | 状态: 就绪
基于飞书文档需求 + Opus产品架构 + 开源项目研究(Kronos + ai-hedge-fund),制定美股投研工具完整方案。
| int prime[MAX_N]; | |
| bool is_prime[MAX_N+1]; | |
| int sieve(int n){ | |
| int p = 0; | |
| for(int i=0;i<=n;i++) is_prime[i] = true; | |
| is_prime[0] = is_prime[1] = false; | |
| for(int i=2;i<=n;i++){ | |
| if(is_prime[i]){ | |
| prime[p++] = i; |
| //递归O(2的n次方) | |
| int s1(n){ | |
| if(n<1) return 0; | |
| if(n==1 || n==2){ | |
| return 1;//跨台阶这里是n | |
| } | |
| return s1(n-1) + s1(n-2); | |
| } | |
| //动态规划O(n) |
| void getNext(const std::string &p, std::vector<int> &next) | |
| { | |
| next.resize(p.size()); | |
| next[0] = -1; | |
| int i = 0, j = -1; | |
| while (i != p.size() - 1) | |
| { | |
| //这里注意,i==0的时候实际上求的是next[1]的值,以此类推 |
| int main(){} |
| #include<stdio.h> | |
| #include<stdlib.h> | |
| int max(int a, int b); | |
| /* Returns length of LCS for X[0..m-1], Y[0..n-1] */ | |
| int lcs( char *X, char *Y, int m, int n ) | |
| { | |
| int L[m+1][n+1]; | |
| int i, j; |
| const int MAX_N = 100000; | |
| int N,S[MAX_N],T{MAX_N]; | |
| pair<int, int> itv[MAX_N]; | |
| void solve(){ | |
| for(int i=0;i<N;i++){ | |
| itv[i].first = T[i]; | |
| itv[i].second = S[i]; | |
| } | |
| sort(itv, itv+N); | |
| int ans=0, t=0; |
| int a[4] = {1,2,4,7}; | |
| int n = 4, k=13; | |
| bool dfs(int i, int sum){ | |
| if(i == n) return (sum == k); | |
| if(dfs(i+1,sum)) return true; | |
| if(dfs(i+1,sum+a[i])) return true; | |
| return false; | |
| } |
| struct node{ | |
| int val; | |
| node *lch,*rch; | |
| } | |
| node *insert(node *p, int x){ | |
| if(p == NULL){ | |
| node *q = new node; | |
| q->val = x; | |
| q->lch = q->rch = NULL; |
| int* next = new int[needle.length()]; | |
| next[0] = 0; | |
| int k = 0; | |
| for(int i=1;i<needle.length();i++){ | |
| //个人理解是头尾匹配,循环判断 | |
| while(k>0 && needle[k] != needle[i]) k=next[k-1]; | |
| if(needle[k] == needle[i]) k++; | |
| next[i] = k; | |
| } |