上一页 1 2 3 4 5 6 7 8 9 ··· 85 下一页
摘要: A 题意:n是否能被k个不同的正奇数表示。 #include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<algorithm> #include<string> #include<iostream> #in 阅读全文
posted @ 2020-03-24 22:16 Somnuspoppy 阅读(120) 评论(1) 推荐(0) 编辑
摘要: 题意:求BST中两点的最近公共祖先。 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : va 阅读全文
posted @ 2020-03-24 15:40 Somnuspoppy 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 题意:把二叉查找树每个节点的值都加上比它大的节点的值。 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(in 阅读全文
posted @ 2020-03-23 17:30 Somnuspoppy 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 一、模板 结构体 struct Trie{ int val; Trie *nex[26]; Trie(){ val = 0; for(int i = 0; i < 26; ++i) nex[i] = NULL; } }; 建树 void build(string x, Trie *root){ in 阅读全文
posted @ 2020-03-23 14:49 Somnuspoppy 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 第一题:Allocation 题意:N个房子,第i个房子价格为Ai美元,用B美元最多买几个房子。 Limit: 1 ≤ T ≤ 100. 1 ≤ B ≤ 10^5. 1 ≤ Ai ≤ 1000, for all i. 1 ≤ N ≤ 10^5. 分析:按价格从小到大排序即可。 #include<cs 阅读全文
posted @ 2020-03-23 11:33 Somnuspoppy 阅读(463) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 85 下一页