Codeforces Round 949 (Div. 2 ABCD) 视频讲解

A. Turtle and Piggy Are Playing a Game

Problem Statement

Turtle and Piggy are playing a number game.

First, Turtle will choose an integer x x x, such that l ≤ x ≤ r l \le x \le r lxr, where l , r l, r l,r are given. It’s also guaranteed that 2 l ≤ r 2l \le r 2lr.

Then, Piggy will keep doing the following operation until x x x becomes 1 1 1:

  • Choose an integer p p p such that p ≥ 2 p \ge 2 p2 and p ∣ x p \mid x px (i.e. x x x is a multiple of p p p).
  • Set x x x to x p \frac{x}{p} px, and the score will increase by 1 1 1.

The score is initially 0 0 0. Both Turtle and Piggy want to maximize the score. Please help them to calculate the maximum score.

Input

Each test contains multiple test cases. The first line contains the number of test cases t t t ( 1 ≤ t ≤ 1 0 4 1 \le t \le 10^4 1t104). The description of the test cases follows.

The first line of each test case contains two integers l , r l, r l,r ( 1 ≤ l ≤ r ≤ 1 0 9 , 2 l ≤ r 1 \le l \le r \le 10^9, 2l \le r 1lr109,2lr) — The range where Turtle can choose the integer from.

Output

For each test case, output a single integer — the maximum score.

Example

Example

input
5
2 4
3 6
2 15
6 22
114514 1919810
output
2
2
3
4
20

Note

In the first test case, Turtle can choose an integer x x x, such that 2 ≤ x ≤ 4 2 \le x \le 4 2x4. He can choose x = 4 x = 4 x=4. Then Piggy can choose p = 2 p = 2 p=2 for 2 2 2 times. After that, x x x will become 1 1 1, and the score will be 2 2 2, which is maximized.

In the second test case, Turtle can choose an integer 3 ≤ x ≤ 6 3 \le x \le 6 3x6. He can choose x = 6 x = 6 x=6. Then Piggy can choose p = 2 p = 2 p=2, then choose p = 3 p = 3 p=3. After that, x x x will become 1 1 1, and the score will be 2 2 2, which is maximum.

In the third test case, Turtle can choose x = 12 x = 12 x=12.

In the fourth test case, Turtle can choose x = 16 x = 16 x=16.

Solution

具体见文后视频。


Code

#include <bits/stdc++.h>
#define fi first
#define se second
#define int long longusing namespace std;typedef pair<int, int> PII;
typedef long long LL;void solve() {int l, r;cin >> l >> r;int x = 0;while ((1ll << x) <= r) x ++;x --;cout << x << endl;
}signed main() {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);int dt;cin >> dt;while (dt --)solve();return 0;
}

B. Turtle and an Infinite Sequence

Problem Statement

There is a sequence a 0 , a 1 , a 2 , … a_0, a_1, a_2, \ldots a0,a1,a2, of infinite length. Initially a i = i a_i = i ai=i for every non-negative integer i i i.

After every second, each element of the sequence will simultaneously change. a i a_i ai will change to a i − 1 ∣ a i ∣ a i + 1 a_{i - 1} \mid a_i \mid a_{i + 1} ai1aiai+1 for every positive integer i i i. a 0 a_0 a0 will change to a 0 ∣ a 1 a_0 \mid a_1 a0a1. Here, ∣ | denotes bitwise OR.

Turtle is asked to find the value of a n a_n an after m m m seconds. In particular, if m = 0 m = 0 m=0, then he needs to find the initial value of a n a_n an. He is tired of calculating so many values, so please help him!

Input

Each test contains multiple test cases. The first line contains the number of test cases t t t ( 1 ≤ t ≤ 1 0 4 1 \le t \le 10^4 1t104). The description of the test cases follows.

The first line of each test case contains two integers n , m n, m n,m ( 0 ≤ n , m ≤ 1 0 9 0 \le n, m \le 10^9 0n,m109).

Output

For each test case, output a single integer — the value of a n a_n an after m m m seconds.

Example

Example

input
9
0 0
0 1
0 2
1 0
5 2
10 1
20 3
1145 14
19198 10
output
0
1
3
1
7
11
23
1279
19455

Note

After 1 1 1 second, [ a 0 , a 1 , a 2 , a 3 , a 4 , a 5 ] [a_0, a_1, a_2, a_3, a_4, a_5] [a0,a1,a2,a3,a4,a5] will become [ 1 , 3 , 3 , 7 , 7 , 7 ] [1, 3, 3, 7, 7, 7] [1,3,3,7,7,7].

After 2 2 2 seconds, [ a 0 , a 1 , a 2 , a 3 , a 4 , a 5 ] [a_0, a_1, a_2, a_3, a_4, a_5] [a0,a1,a2,a3,a4,a5] will become [ 3 , 3 , 7 , 7 , 7 , 7 ] [3, 3, 7, 7, 7, 7] [3,3,7,7,7,7].

Solution

具体见文后视频。


Code

#include <bits/stdc++.h>
#define fi first
#define se second
#define int long longusing namespace std;typedef pair<int, int> PII;
typedef long long LL;void solve() {int n, m;cin >> n >> m;int l = max(0ll, n - m), r = n + m;if (l == r) cout << l << endl;for (int i = 30; i >= 0; i --)if ((r >> i & 1) && !(l >> i & 1)) {cout << (l | ((1ll << i + 1) - 1)) << endl;return;}
}signed main() {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);int dt;cin >> dt;while (dt --)solve();return 0;
}

C. Turtle and an Incomplete Sequence

Problem Statement

Turtle was playing with a sequence a 1 , a 2 , … , a n a_1, a_2, \ldots, a_n a1,a2,,an consisting of positive integers. Unfortunately, some of the integers went missing while playing.

Now the sequence becomes incomplete. There may exist an arbitrary number of indices i i i such that a i a_i ai becomes − 1 -1 1. Let the new sequence be a ′ a' a.

Turtle is sad. But Turtle remembers that for every integer i i i from 1 1 1 to n − 1 n - 1 n1, either a i = ⌊ a i + 1 2 ⌋ a_i = \left\lfloor\frac{a_{i + 1}}{2}\right\rfloor ai=2ai+1 or a i + 1 = ⌊ a i 2 ⌋ a_{i + 1} = \left\lfloor\frac{a_i}{2}\right\rfloor ai+1=2ai holds for the original sequence a a a.

Turtle wants you to help him complete the sequence. But sometimes Turtle makes mistakes, so you need to tell him if you can’t complete the sequence.

Formally, you need to find another sequence b 1 , b 2 , … , b n b_1, b_2, \ldots, b_n b1,b2,,bn consisting of positive integers such that:

  • For every integer i i i from 1 1 1 to n n n, if a i ′ ≠ − 1 a'_i \ne -1 ai=1, then b i = a i ′ b_i = a'_i bi=ai.
  • For every integer i i i from 1 1 1 to n − 1 n - 1 n1, either b i = ⌊ b i + 1 2 ⌋ b_i = \left\lfloor\frac{b_{i + 1}}{2}\right\rfloor bi=2bi+1 or b i + 1 = ⌊ b i 2 ⌋ b_{i + 1} = \left\lfloor\frac{b_i}{2}\right\rfloor bi+1=2bi holds.
  • For every integer i i i from 1 1 1 to n n n, 1 ≤ b i ≤ 1 0 9 1 \le b_i \le 10^9 1bi109.

If there is no sequence b 1 , b 2 , … , b n b_1, b_2, \ldots, b_n b1,b2,,bn that satisfies all of the conditions above, you need to report − 1 -1 1.

Input

Each test contains multiple test cases. The first line contains the number of test cases t t t ( 1 ≤ t ≤ 1 0 5 1 \le t \le 10^5 1t105). The description of the test cases follows.

The first line of each test case contains a single integer n n n ( 2 ≤ n ≤ 2 ⋅ 1 0 5 2 \le n \le 2 \cdot 10^5 2n2105) — the length of the sequence.

The second line of each test case contains n n n integers a 1 ′ , a 2 ′ , … , a n ′ a'_1, a'_2, \ldots, a'_n a1,a2,,an ( a i ′ = − 1 a'_i = -1 ai=1 or 1 ≤ a i ′ ≤ 1 0 8 1 \le a'_i \le 10^8 1ai108) — the elements of the sequence a ′ a' a.

It is guaranteed that the sum of n n n over all test cases does not exceed 2 ⋅ 1 0 5 2 \cdot 10^5 2105.

Output

For each test case, if there is no sequence b 1 , b 2 , … , b n b_1, b_2, \ldots, b_n b1,b2,,bn that satisfies all of the conditions, output a single integer − 1 -1 1.

Otherwise, output n n n integers b 1 , b 2 , … , b n b_1, b_2, \ldots, b_n b1,b2,,bn — the elements of the sequence b 1 , b 2 , … , b n b_1, b_2, \ldots, b_n b1,b2,,bn you find. The sequence should satisfy that 1 ≤ b i ≤ 1 0 9 1 \le b_i \le 10^9 1bi109 for every integer i i i from 1 1 1 to n n n. If there are multiple answers, print any of them.

Example

input
9
8
-1 -1 -1 2 -1 -1 1 -1
4
-1 -1 -1 -1
6
3 -1 -1 -1 9 -1
4
-1 5 -1 6
4
2 -1 -1 3
4
1 2 3 4
2
4 2
5
-1 3 -1 3 6
13
-1 -1 3 -1 -1 -1 -1 7 -1 -1 3 -1 -1
output
4 9 4 2 4 2 1 2
7 3 6 13
3 1 2 4 9 18
-1
-1
-1
4 2
6 3 1 3 6
3 1 3 1 3 7 3 7 3 1 3 1 3

Note

In the first test case, [ 4 , 2 , 1 , 2 , 1 , 2 , 1 , 3 ] [4, 2, 1, 2, 1, 2, 1, 3] [4,2,1,2,1,2,1,3] can also be the answer, while [ 4 , 2 , 5 , 10 , 5 , 2 , 1 , 3 ] [4, 2, 5, 10, 5, 2, 1, 3] [4,2,5,10,5,2,1,3] and [ 4 , 2 , 1 , 2 , 1 , 2 , 1 , 4 ] [4, 2, 1, 2, 1, 2, 1, 4] [4,2,1,2,1,2,1,4] cannot.

In the second test case, [ 1 , 2 , 5 , 2 ] [1, 2, 5, 2] [1,2,5,2] can also be the answer.

From the fourth to the sixth test cases, it can be shown that there is no answer, so you should output − 1 -1 1.

Solution

具体见文后视频。


Code

#include <bits/stdc++.h>
#define fi first
#define se second
#define int long longusing namespace std;typedef pair<int, int> PII;
typedef long long LL;void solve() {int n;cin >> n;std::vector<int> a(n + 1), b(n + 1, -1);bool cs = 1;for (int i = 1; i <= n; i ++) cin >> a[i], cs &= (a[i] == -1);if (cs) {for (int i = 1, j = 1; i <= n; i ++, j ^= 1)if (j) cout << 1 << " ";else cout << 2 << " ";cout << endl;return;}int lst = -1, pos, cnt = 0;for (int i = 1; i <= n; i ++)if (a[i] != -1) {if (lst != -1) {std::vector<int> avl;int tmp = lst;while (tmp) avl.emplace_back(tmp), tmp /= 2;bool flg = 0;for (int j = 0; j < avl.size(); j ++) {for (int x = 0; avl[j] * (1ll << x) <= a[i]; x ++) {tmp = a[i] - avl[j] * (1ll << x);if (tmp >= (1ll << x) || x + j > i - pos || (i - pos - x - j) % 2 != 0) continue;for (int k = pos, v = lst; k <= pos + j; k ++, v /= 2)b[k] = v;for (int k = pos + j + 1; k <= i - x; k += 2)b[k] = avl[j] * 2, b[k + 1] = avl[j];for (int k = i - x + 1, v = x - 1; k <= i; k ++, v --)if (tmp >> v & 1) b[k] = b[k - 1] * 2 + 1;else b[k] = b[k - 1] * 2;flg = 1;break;}if (flg) break;}}lst = a[i], pos = i, cnt ++;}if (cnt == 1) {for (int i = 1; i <= n; i ++)if (a[i] != -1)b[i] = a[i];}for (int i = 1; i <= n; i ++)if (a[i] != -1) {for (int j = i - 1, k = 1; j >= 1; j --, k ^= 1)if (k) b[j] = a[i] * 2;else b[j] = a[i];break;}for (int i = n; i >= 1; i --)if (a[i] != -1) {for (int j = i + 1, k = 1; j <= n; j ++, k ^= 1)if (k) b[j] = a[i] * 2;else b[j] = a[i];break;}for (int i = 1; i < n; i ++)if (b[i] <= 0 || b[i] / 2 != b[i + 1] && b[i + 1] / 2 != b[i]) {cout << -1 << endl;return;}for (int i = 1; i <= n; i ++)cout << b[i] << " ";cout << endl;
}signed main() {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);int dt;cin >> dt;while (dt --)solve();return 0;
}

D. Turtle and Multiplication

Problem Statement

Turtle just learned how to multiply two integers in his math class, and he was very excited.

Then Piggy gave him an integer n n n, and asked him to construct a sequence a 1 , a 2 , … , a n a_1, a_2, \ldots, a_n a1,a2,,an consisting of integers which satisfied the following conditions:

  • For all 1 ≤ i ≤ n 1 \le i \le n 1in, 1 ≤ a i ≤ 3 ⋅ 1 0 5 1 \le a_i \le 3 \cdot 10^5 1ai3105.
  • For all 1 ≤ i < j ≤ n − 1 1 \le i < j \le n - 1 1i<jn1, a i ⋅ a i + 1 ≠ a j ⋅ a j + 1 a_i \cdot a_{i + 1} \ne a_j \cdot a_{j + 1} aiai+1=ajaj+1.

Of all such sequences, Piggy asked Turtle to find the one with the minimum number of distinct elements.

Turtle definitely could not solve the problem, so please help him!

Input

Each test contains multiple test cases. The first line contains the number of test cases t t t ( 1 ≤ t ≤ 1 0 4 1 \le t \le 10^4 1t104). The description of the test cases follows.

The first line of each test case contains a single integer n n n ( 2 ≤ n ≤ 1 0 6 2 \le n \le 10^6 2n106) — the length of the sequence a a a.

It is guaranteed that the sum of n n n over all test cases does not exceed 1 0 6 10^6 106.

Output

For each test case, output n n n integers a 1 , a 2 , … , a n a_1, a_2, \ldots, a_n a1,a2,,an — the elements of the sequence a a a.

If there are multiple answers, print any of them.

Example

input
3
2
3
4
output
114514 114514
1 2 2
3 3 4 4

Note

In the third test case, a = [ 3 , 4 , 2 , 6 ] a = [3, 4, 2, 6] a=[3,4,2,6] violates the second condition since a 1 ⋅ a 2 = a 3 ⋅ a 4 a_1 \cdot a_2 = a_3 \cdot a_4 a1a2=a3a4. a = [ 2 , 3 , 4 , 4 ] a = [2, 3, 4, 4] a=[2,3,4,4] satisfy the conditions but its number of distinct elements isn’t minimum.

Solution

具体见文后视频。

Code

#include <bits/stdc++.h>
#define fi first
#define se second
#define int long longusing namespace std;typedef pair<int, int> PII;
typedef long long LL;const int N = 4e6 + 10;int n;
int h[N], e[N], ne[N], idx, vis[N];
std::vector<int> path, prm;
vector<int> Prime(int n) {std::vector<int> st(n + 1, 0), prm;for (int i = 2; i <= n; i ++) {if (!st[i]) prm.emplace_back(i);for (int j = 0; prm[j] * i <= n; j ++) {st[prm[j] * i] = true;if (i % prm[j] == 0) break;}}return prm;
}
void dfs(int u) {for (int &i = h[u]; ~i;) if (!vis[i]) {int j = e[i];vis[i] = vis[i ^ 1] = 1, i = ne[i], dfs(j);} elsei = ne[i];path.emplace_back(u);
}
void add(int a, int b) {e[idx] = b, ne[idx] = h[a], h[a] = idx ++;
}void solve() {cin >> n;int l = 1, r = n;while (l < r) {int mid = l + r >> 1;if ((mid & 1) && mid * (mid + 1) / 2 >= n - 1) r = mid;else if ((mid % 2 == 0) && mid * mid / 2 + 1 >= n - 1) r = mid;else l = mid + 1;}path.clear();for (int i = 0; i < r; i ++)for (int j = i; j < r; j ++)if ((r & 1) || j != i + 1 || i % 2 == 0)add(i, j), add(j, i);dfs(0), reverse(path.begin(), path.end());for (int i = 0; i < n; i ++)cout << prm[path[i]] << " ";cout << endl;for (int i = 0; i < r; i ++)h[i] = -1;for (int i = 0; i < idx; i ++) vis[i] = false;idx = 0;
}signed main() {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);prm = Prime(100000);memset(h, -1, sizeof h);int dt;cin >> dt;while (dt -- )solve();return 0;
}


视频讲解

Codeforces Round 949 (Div. 2)(A ~ D 题讲解)


最后祝大家早日在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/846014.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

OpenAI 的 GPT-4o 是目前最先进的人工智能模型!如何在工作或日常生活中高效利用它?

OpenAI 的 GPT-4o 是目前最先进的人工智能模型&#xff01;如何在工作或日常生活中高效利用它&#xff1f; 博主猫头虎的技术世界 &#x1f31f; 欢迎来到猫头虎的博客 — 探索技术的无限可能&#xff01; 专栏链接&#xff1a; &#x1f517; 精选专栏&#xff1a; 《面试题大…

RabbitMQ延时队列

一、RabbitMQ下载并使用插件 1、查看RabbitMQ插件的文件路径 docker inspect rabbitmq 找到Mounts下面Name:rabbitmq_plugin的Source即为插件路径 使用 cd 进入到该目录 2、下载插件 wget https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download…

vue-el-steps 使用1(上一步、下一步)

vue代码 <template> <div class"app-container"> <el-steps :active"active" finish-status"success" simple style"margin-top: 20px"> <el-step title"选择分类"></el-step> <el-step t…

字典树,AcWing 5726. 连续子序列

一、题目 1、题目描述 2、输入输出 2.1输入 2.2输出 3、原题链接 5726. 连续子序列 - AcWing题库 二、解题报告 1、思路分析 字典树存储前缀和 考虑边遍历计算前缀和&#xff0c;边查询字典树 查询流程&#xff1a; 记当前前缀和为s 如果当前位k为1&#xff0c;那么s …

苹果电脑如何清理最近打开的文稿记录 Mac如何移除浏览痕迹保护隐私

日常使用苹果电脑的过程中&#xff0c;我们经常会打开各种文稿&#xff0c;浏览网页等操作。然而&#xff0c;这些操作可能会留下一些记录&#xff0c;涉及到个人隐私和数据安全问题。下面我们来看看苹果电脑如何清理最近打开的文稿记录&#xff0c;Mac如何移除浏览痕迹保护隐私…

C++进阶篇章:set与map(pair , multiset , multimap)

目录 1.关联式容器与序列式容器 2.pair&#xff08;键值对&#xff09; 3.set 构造函数 find函数 count函数&#xff1a; insert函数 4.multiset 5.map insert函数 operator[] 1.关联式容器与序列式容器 C中关联式容器与序列式容器是两种不同的容器 1.关联式容器 关…

力扣--双指针15.三数之和

详细思路 排序数组&#xff1a;首先对数组 nums 进行排序&#xff0c;目的是为了方便后续使用双指针查找和避免重复结果。遍历数组&#xff1a;使用一个 for 循环从头遍历到倒数第三个元素。i 表示当前固定的元素。 跳过重复元素&#xff1a;如果当前元素 nums[i] 与前一个元素…

SpringBoot项目实现自定义注解方式的接口限流

一&#xff0c;实现原理 该限流方式使用的是令牌桶算法&#xff0c;令牌桶算法是基于漏桶算法的一种改进&#xff0c;主要在于令牌桶算法能够在限制服务调用的平均速率的同时&#xff0c;还能够允许一定程度内的突发调用。 系统以固定的速率向桶中添加令牌当有请求到来时&#…

张大哥笔记:你卖什么,就反着来卖

普通人打工的一生&#xff0c;就是努力工作&#xff0c;买房&#xff0c;买车&#xff0c;送孩子上好的学校&#xff0c;为了孩子不要输在起跑线上&#xff0c;拼命报各种补习班等&#xff0c;这些都是普通人认为的主流价值观文化&#xff0c;也造就了一批批的赚钱机器&#xf…

带DSP音效处理D类数字功放TAS5805M中文资料

国产替代D类数字功放中文资料访问下方链接 ACM8628 241W立体声182W单通道数字功放中文寄存器表 内置DSP多种音频处理效果ACM8628M-241W立体声或182W单通道数字功放 1 特性 具有增强处理能力和低功率损耗的 TAS5805M 23W、无电感器、数字输入、立体声、闭环 D 类音频放大器 …

华为设备配置静态路由和默认路由

华为设备配置静态路由和默认路由 理论部分知识&#xff1a; 路由分为两个大类&#xff1a;静态路由-----动态路由 静态路由&#xff1a;手工指定&#xff0c;适用于小规模的网络应用场景&#xff0c;如果网络规模变大&#xff0c;这样的方式非常不适合而且容易出错。 语法&…

Java之IO流

一、引言 &#xff08;1&#xff09;解释&#xff1a; i&#xff1a;input &#xff08;输入&#xff09; o&#xff1a;output &#xff08;输出&#xff09; &#xff08;2&#xff09;图解 注意&#xff1a; 1、Xxx 这个程序一旦在桌面关闭掉了&#xff0c;也就是运行完…

动态路由OSPF单区域和多区域配置实验

动态路由OSPF的配置 OSPF分类两种情况&#xff1a;单区域 多区域路由 OSPF单区域路由配置 OSPF&#xff1a;开放最短路径优先的路由协议。属于大型动态路由协议&#xff0c;适用于中大型的园区网。 网络拓扑&#xff1a; 配置步骤&#xff1a; 1.完成基本配置&#xff08;略&…

能耗监测系统在上海交通大学闵行校区理科实验楼群的设计与应用

引言 建筑能耗系统&#xff0c;除了基本的电力参数监测、配电系统的运行状况&#xff0c;更加关注能耗的去向。除了常规的园区楼层出线电能计量&#xff0c;还会涉及水&#xff0c;气等能耗计量。 针对上海交通大学闵行校区理科实验楼群能耗监测系统的具体要求&#xff0c;以…

依赖管理包介绍

文章目录 1. 概念介绍2. 思路与方法2.1 实现思路2.2 相关组件 3. 示例代码4. 内容总结 我们在上一章回中介绍了"使用get进行依赖管理"相关的内容&#xff0c;本章回中将介绍如何使用get进行状态管理一.闲话休提&#xff0c;让我们一起Talk Flutter吧。 1. 概念介绍 …

C语言:如何在微软VS环境下使用C库?

技术答疑流程 扫描二维码&#xff0c;添加个人微信&#xff1b;支付一半费用&#xff0c;获取答案&#xff1b;如果满意&#xff0c;则支付另一半费用&#xff1b; 知识点费用&#xff1a;10元 项目费用&#xff1a;如果有项目任务外包需求&#xff0c;可以微信私聊

IP路由策略1

控制层面:路由协议传递路由信息的流量--对应的方向 数据层面:设备间具体访问时请求的流量--对应方向 控制层面方向与数据层面方向一定相反 在控制层面流量进或出的接口上&#xff0c;抓取流量后&#xff0c;修改其中参数或删除该信息&#xff0c;最终起到影响路由器路由表的生…

「Django秘境探险:揭开Web开发的神秘面纱」

大家好&#xff0c;我是阿佑&#xff0c;今天将和大家一块学习到如何利用Django框架的高级特性&#xff0c;构建出既快速又安全的Web应用。我们将一起破解Django的内部机制&#xff0c;掌握从数据模型到模板设计的每一个环节。准备好了吗&#xff1f;Let’s go &#xff01; 文…

“手撕”链表的九道OJ习题

目录 1. 第一题 2. 第二题 3. 第三题 4. 第四题 5. 第五题 6. 第六题 7. 第七题 8. 第八题 9. 第九题 1. 第一题 删除链表中等于给定值 val 的所有节点。OJ链接 思路如下&#xff1a; 相当于链表的removeAll();制定prev和cur&#xff0c;prev记录前一个节点&#xff…