摘要: #include<iostream> #include<string> #include<map> using namespace std; map<int, string> m = {{0, "zero"}, {1, "one"}, {2, "two"}, {3, "three"}, {4, "four"}, {5, "five"}, {6, "six"}, {7, "seven"}, 阅读全文
posted @ 2019-08-08 17:28 Stoves 阅读(74) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; struct TreeNode { int father = 0; int level = 0; bool isLeaf = true; }; TreeNode t[100]; int main() { int N, M; while(cin>>N>>M) { //input int ID, K, child, num 阅读全文
posted @ 2019-08-07 20:16 Stoves 阅读(94) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int n, m, c1, c2;//dis[i]从起点到i的最短路径,num[i]为长度,weight[i]为i城的救援小组人数,w[i]为到i城已经接到的救援人数,e[][]路径权重 int dis[500], num[500], weight[500], w[500], e[500][500]... 阅读全文
posted @ 2019-08-05 16:58 Stoves 阅读(110) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; int main() { string s1, s2; while(getline(cin, s1) && getline(cin, s2)) { stringstream ss1, ss2; map m; ... 阅读全文
posted @ 2019-08-02 16:36 Stoves 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 初版 修改版晚点给 阅读全文
posted @ 2019-08-02 10:29 Stoves 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 老师布置的任务 python实现 阅读全文
posted @ 2019-07-31 20:25 Stoves 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 实验室老师布置的小作业,水题。 python实现(我python语法比较差) 阅读全文
posted @ 2019-07-31 20:24 Stoves 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 思路: 初版思路是将序列按照0拆开成若干子序列,然后在每个子序列里面判断负数的个数,若负数是偶数,直接相乘,若负数是奇数,要么从左往右相乘直到最后一个奇数,要么从右向左相乘知道第一个奇数 修改版的思路是从左往右遍历+从右往左遍历,使用dp[i]保存相应方向直接相乘到i的数值。碰到0就跳过重新开始计算 阅读全文
posted @ 2019-07-30 18:37 Stoves 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 简单dp。状态转移方程:dp[i] = max(dp[i-2] + nums[i], dp[i-1]); 阅读全文
posted @ 2019-07-30 10:59 Stoves 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 题目描述 有若干张邮票,要求从中选取最少的邮票张数凑成一个给定的总值。 如,有1分,3分,3分,3分,4分五张邮票,要求凑成10分,则使用3张邮票:3分、3分、4分即可。 输入描述: 有多组数据,对于每组数据,首先是要求凑成的邮票总值M,M<100。然后是一个数N,N〈20,表示有N张邮票。接下来是 阅读全文
posted @ 2018-12-30 19:55 Stoves 阅读(327) 评论(0) 推荐(0) 编辑