0%

修改用户名

登出需要修改用户名的用户,使用root账号修改用户名和用户根目录。
需要修改的文件有:/etc/passwd、/etc/shadow、/etc/group,把这些文件中需要修改的用户名改成新的用户名,然后修改/home下需要修改的用户的根目录
为新的用户名,并且递归修改其所属的用户和用户组

修改密码

使用root账户设置需要修改密码的用户的密码,命令为:

1
passwd 用户名

参考链接:https://blog.csdn.net/gahsfjshf/article/details/121115663

力扣(LeetCode)
链接:662. 二叉树最大宽度

题目描述如下:

给你一棵二叉树的根节点 root ,返回树的 最大宽度 。

树的 最大宽度 是所有层中最大的 宽度 。

每一层的 宽度 被定义为该层最左和最右的非空节点(即,两个端点)之间的长度。将这个二叉树视作与满二叉树结构相同,两端点间会出现一些延伸到这一层的 null 节点,这些 null 节点也计入长度。

题目数据保证答案将会在  32 位 带符号整数范围内。

阅读全文 »

来源:力扣(LeetCode)
链接:658. 找到 K 个最接近的元素

题目描述如下:

给定一个 排序好 的数组 arr ,两个整数 k 和 x ,从数组中找到最靠近 x(两数之差最小)的 k 个数。返回的结果必须要是按升序排好的。

整数 a 比整数 b 更接近 x 需要满足:

来源:力扣(LeetCode)
链接:1460. 通过翻转子数组使两个数组相等

题目描述如下:

给你两个长度相同的整数数组 target 和 arr 。每一步中,你可以选择 arr 的任意 非空子数组 并将它翻转。你可以执行此过程任意次。

如果你能让 arr 变得与 target 相同,返回 True;否则,返回 False 。

阅读全文 »

题目链接:1085 Perfect Sequence (25分)

题目描述如下:

作者 CAO, Peng
单位 浙江大学
代码长度限制 16 KB
时间限制 200 ms
内存限制 64 MB
1085 Perfect Sequence (25分)
Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m×p where M and m are the maximum and minimum numbers in the sequence, respectively.

Now given a sequence and a parameter p, you are supposed to find from the sequence as many numbers as possible to form a perfect subsequence.

阅读全文 »

题目链接:1052 Linked List Sorting (25分)

题目描述如下:

作者: CHEN, Yue
单位: 浙江大学
时间限制: 400 ms
内存限制: 64 MB
代码长度限制: 16 KB
1052 Linked List Sorting (25分)
A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now given a linked list, you are supposed to sort the structures according to their key values in increasing order.

阅读全文 »

题目链接:1037 Magic Coupon (25 分)

题目描述如下:

作者: CHEN, Yue
单位: 浙江大学
时间限制: 400 ms
内存限制: 64 MB
代码长度限制: 16 KB
1037 Magic Coupon (25 分)
The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times the value of that product back! What is more, the shop also offers some bonus product for free. However, if you apply a coupon with a positive N to this bonus product, you will have to pay the shop N times the value of the bonus product… but hey, magically, they have some coupons with negative N’s!

For example, given a set of coupons { 1 2 4 −1 }, and a set of product values { 7 6 −2 −3 } (in Mars dollars M$) where a negative value corresponds to a bonus product. You can apply coupon 3 (with N being 4) to product 1 (with value M$7) to get M$28 back; coupon 2 to product 2 to get M$12 back; and coupon 4 to product 4 to get M$3 back. On the other hand, if you apply coupon 3 to product 4, you will have to pay M$12 to the shop.

Each coupon and each product may be selected at most once. Your task is to get as much money back as possible.

阅读全文 »

题目链接:1036 Boys vs Girls (25 分)

题目描述如下:

作者: CHEN, Yue
单位: 浙江大学
时间限制: 400 ms
内存限制: 64 MB
代码长度限制: 16 KB
1036 Boys vs Girls (25 分)
This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.

阅读全文 »