Ubuntu r8168模块编译错误的解决办法
更新了Ubuntu 16.10之后,发现有线连接模块消失了,于是又和以前一样对r8168进行编译安装。具体的方法请参考我的另一篇文章: Ubuntu以太网已断开的解决办法
结果发现在 ‘make clean modules’ 这一步居然出错了。错误信息如下:
12345678910/home/user/download/r8168-8.042.00/src/r8168_n.c: In function ‘rtl8168_init_one’:/home/user/download/r8168-8.042.00/src/r8168_n.c:22799:28: error: ‘struct net_device’ has no member named ‘gso_min_segs’; did you mean ‘gso_max_segs’? dev->gso_min_segs = NIC_MIN_PHYS_BUF_COUNT; ^~/home/yuukidach/下载/r8168-8. ...
UVa OJ 1220 - Party at Hali-Bula
Problem
Here is the: problem link
Solution
这道题目一开始没有用f[][]来标记是否重复,导致WA了一次,后来就加上去了。另外,在处理人名时,虽然实例输入里,上司和下属名字出现是有先后的,但是提交之后,系统的测试数据貌似不一定是这样,所以要先判断是否出现,没出现就用cnt加1再赋值
递归的思路还是不难的,选了上司,那么直属员工就不选,用d[][0]表示不选;没选的话就可以选直属员工,也可以不选,分别是d[][1]和d[][0]
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768#include <iostream>#include <cstdio>#include <map>#include <vector>#include <cstring>using namespace std;# ...
UVa OJ 12186 - Another Crisis
Problem
A couple of years ago, a new world wide crisis started, leaving many people with economical problems. Some workers of a particular company are trying to ask for an increase in their salaries.
The company has a strict hierarchy, in which each employee has exactly one direct boss, with the exception of the owner of the company that has no boss. Employees that are not bosses of any other employee are called workers. The rest of the employees and the owner are called bosses. To ask for a s ...
UVa OJ 1331 - Minimax Triangulation
Problem
Here is the: problem link
Solution
这道题目一开始用递归做,但是时间比较长,于是花了比较长的时间去想应该怎么才能转化成递推
这道题目用d[i][j]来表示从i点切割到j点中所含的面积最大的三角形中,最小的那个
这里用了三个循环,第一层是确定分割时跨越的点数,第二层是起点,第三层就是起点和终点中任意取一点分割。同时还要注意分割时会不会有点卡在中间导致实际上不能被分割的情况
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051#include <iostream>#include <cstdio>#include <cmath>#include <iomanip>using namespace std;const int maxn = 55;int n, cas;double x[maxn], y[maxn], d[maxn][maxn];double cntA ...
UVa OJ 10003 - Cutting Sticks
Problem
You have to cut a wood stick into pieces. The most affordable company, The Analog Cutting Machinery, Inc. (ACM), charges money according to the length of the stick being cut. Their procedure of work requires that they only make one cut at a time.
It is easy to notice that different selections in the order of cutting can led to different prices. For example, consider a stick of length 10 meters that has to be cut at 2, 4 and 7 meters from one end. There are several choices. One can be cu ...
UVa OJ 1625 - Color Length
Problem
Here is the prolem link
Solution
这道题目要先处理好每个颜色的起止位置,不然会很不方便。用数组d[i][j]表示已经插入了第一个字符串的i个,第二个字符串的j个字母。递推的时候,只要发现还有字母没有用完,就加1
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int maxn = 5002;char n[maxn], m[maxn];int cas, l1, l2;int begs[2][26], endz[2][26], d[maxn][maxn];void findLetter(char a[], int l, int o) { for (int i = 1; i <= l; ++i) ...
UVa OJ 11400 - Lighting System Design
Problem
You are given the task to design a lighting system for a huge conference hall. After doing a lot of calculation and sketching, you have figured out the requirements for an energy-efficient design that can properly illuminate the entire hall. According to your design, you need lamps of n different power ratings. For some strange current regulation method, all the lamps need to be fed with the same amount of current. So, each category of lamp has a corresponding voltage rating. Now, you kn ...
UVa OJ 11584 - Partitioning by Palindromes
Problem
Here is the: link
Solution
先对字符串进行预处理,把回文字符串的长度全部记录下来,然后用DP对回文字符串的个数进行处理。最小个数=min(之前已经处理过的长度所含回文字符串的最小值+未处理的长度所含回文字符数的最小值)
123456789101112131415161718192021222324252627282930313233343536373839404142#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int maxn = 1005;char s[maxn];int d[maxn], idx[maxn][maxn], cas;int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); //freopen("input.txt" , "r", stdin ); ...
UVa OJ 116 - Unidirectional TSP
Problem
Here is the: problem link
Solutions
这道题目不难,但是要注意一下输出的格式,我因为输出格式的问题反复提交了好几次
我们用dp[i][j]来表示(i,j)距离最后一列的距离。为了节省时间,用了一个Next[]数组来保存向右走的路径,避免反复取余造成的时间上的浪费。
还有,记得不要用next和end,是关键字 =_=
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253#include <iostream>#include <cstring>#include <cstdio>using namespace std;int r, c, start, End;int Next[12];int block[12][102], idx[12][102];long dp[12][102];int main(){ ios::sync_with_stdio(fa ...
UVa OJ 12563 - Jin Ge Jin Qu hao
Problem
Here is the: link
Solution
这道题目一开始用时间作为一个大循环去进行递推,但是发现并不是很好判断歌曲是否有唱过,所以后来还是采用歌曲作为大循环,再以时间为小循环。不过记得要留出1s来给《劲歌金曲》
123456789101112131415161718192021222324252627282930#include <iostream>#include <cstdio>#include <cstring>using namespace std;int T, n, t, cas, ans;int song[51], dp[9001];long long lis[9001];int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); //freopen("input.txt" , "r", stdin ); //freopen("output.txt", & ...