摘要: // time:20/01/19 23:44//digit 控制位数//tmp 作为中间变量,数组的每个元素 ×下一个 i 值的时候,保存在tmp里面//num 进位的时候,需要用num保存,然后给数组的下一位 #include <bits/stdc++.h>#define M 10010using 阅读全文
posted @ 2019-01-24 14:44 stul 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1.strlen函数。 普通版实现方法, int strlen( char *s) { int length = 0; while(*s++) length++; return length; } 优化版实现方法 int strlen(char *s) { char *str = s; while( 阅读全文
posted @ 2019-01-24 14:43 stul 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 题目大意:有n 个物品,它们有各自的重量和价值,现有给定容量的背包,如何让背包里装入的物品具有最大的价值总和? 每个物品的重量设置为w[i],它的价值设置为c[i]。背包总容量为V。设F[ ] 是每个重量的最大价值。 状态转移方程为 F[i] = max( F[i-1], F[i-w[i]]+c[i 阅读全文
posted @ 2019-01-24 14:38 stul 阅读(110) 评论(0) 推荐(0) 编辑
摘要: You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ii-th lamp is sisi ('R', 'G' and 'B' — colors of 阅读全文
posted @ 2019-01-24 14:24 stul 阅读(116) 评论(0) 推荐(0) 编辑