P1915 [NOI2010] 成长快乐

news2024/10/3 2:24:46

此题为世纪难题

题目提供者 洛谷

难度 NOI/NOI+/CTSC

输入输出样例

输入 #1

5 1 6 0 0
1
5 2 2 0 0

 输出 #1

1
5
5 2 2 1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~此题非常难,小白就不用想着独自完成了

题解:

 

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <complex>
#include <ctime>
#include <cmath>
 
using namespace std;
 
const int maxN = 10010;
const double zero = 1e-12, INF = 1e198;
struct Res
{
	double t; complex <double> p; int ord; Res() {}
	Res(double t, complex <double> p, int ord):
		t(t), p(p), ord(ord) {}
} res[maxN], _res[maxN]; bool eaten[maxN];
complex <double> p[maxN], v[maxN];
double w[maxN], V, _deltaw, deltaw, T, tem;
vector <pair <double, int> > ls;
vector <pair <double, int> >::iterator iter;
int ord[maxN], n, cnt, _cnt;
 
inline bool cmp(const int &a, const int &b)
{return w[a] < w[b];}
 
inline double sqr(double x) {return x * x;}
 
inline double sqr(complex <double> z)
{return sqr(real(z)) + sqr(imag(z));}
 
inline double solve(complex <double> p,
					complex <double> v,
					complex <double> O)
{
	double a = sqr(v) - sqr(V),
	b = -2 * (real(v) * real(O - p) + imag(v) * imag(O - p)),
	c = sqr(p - O),
	delta = sqr(b) - 4 * a * c;
	if (delta < -zero) return INF;
	if (fabs(a) < zero)
		return (b > -zero) ? INF : (-c / b);
	double ans = INF,
		   x1 = (-b - sqrt(delta)) / (2 * a),
		   x2 = (-b + sqrt(delta)) / (2 * a);
	if (x1 > -zero) ans = x1;
	if (x2 > -zero && x2 < ans) ans = x2;
	return ans;
} //计算出从O出发,追赶一个当前位置为p,以速度v移动的小虾所需时间。
 
inline double _rand() {return (double)rand() / RAND_MAX;}
 
inline bool judge()
{
	if (++iter == ls.end()) {--iter; return 0;}
	if (rand() & 1) {--iter; return 0;}
	//先以0.5的概率初步淘汰较差的解。
	double nxt = iter -> first;
	--iter; double ths = iter -> first;
	double delta = (ths - nxt);
	if (delta / ths < 3.40e-2) return 1;
	//若较差的解比当前解差3.4%以上,直接淘汰。
	return _rand() < 1 / exp(delta / tem);
	//否则以概率e ^ (-delta / tem)的概率接受更差的解。
}
 
int main()
{
	freopen("nemo10.in", "r", stdin);
	freopen("nemo10.out", "w", stdout);
	srand(time(NULL));
	scanf("%lf%lf%lf%lf%lf%d", w + 0, &V, &T, &p[0].real(), &p[0].imag(), &n);
	complex <double> p0 = p[0]; double w0 = w[0];
	for (int i = 1; i < n + 1; ord[i] = i, ++i)
		scanf("%lf%lf%lf%lf%lf", w + i, &p[i].real(), &p[i].imag(), &v[i].real(), &v[i].imag());
	sort(ord + 1, ord + n + 1, cmp); //将小虾按体重从小到大的顺序排序。
	tem = 1; //初始温度设为1。
	for (int k = 0; k < 15; ++k)
	{
		memset(eaten, 0, sizeof eaten);
		_deltaw = 0; _cnt = 0; p[0] = p0; w[0] = w0;
		for (double t = 0; t < T;)
		{
			ls.clear();
			for (int i = 1; w[ord[i]] < w[0]; ++i)
			if (!eaten[ord[i]])
				ls.push_back(make_pair(w[ord[i]] / sqr(solve(p[ord[i]] + t * v[ord[i]], v[ord[i]], p[0])), ord[i]));
			sort(ls.begin(), ls.end(), greater <pair <double, int> > ());
			iter = ls.begin(); if (iter == ls.end()) break;
			while (judge()) ++iter;
			int pos = iter -> second;
			if (T - (t += solve(p[pos] + t * v[pos], v[pos], p[0])) < -zero) break;
			_deltaw += w[pos], w[0] += w[pos]; eaten[pos] = 1;
			_res[_cnt++] = Res(t, p[0] = p[pos] + t * v[pos], pos);
		}
		if (_deltaw > deltaw)
		{
			deltaw = _deltaw;
			for (cnt = 0; cnt < _cnt; ++cnt) res[cnt] = _res[cnt];
		} //更新最优解。
		tem *= .5;
	}
	printf("%d\n%.9lf\n", cnt, deltaw);
	for (int i = 0; i < cnt; ++i)
		printf("%.9lf %.9lf %.9lf %d\n", res[i].t, res[i].p.real(), res[i].p.imag(), res[i].ord);
	return 0;
}

 

对于不同的数据,还可以用特殊方法求解。

第一组数据显然手算,不多说。

第二组数据较小,可以暴力枚举,附程序:

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <complex>
 
using namespace std;
 
const int maxN = 10010;
const double zero = 1e-12, INF = 1e198;
struct Res
{
	double t; complex <double> p; int ord; Res() {}
	Res(double t, complex <double> p, int ord):
		t(t), p(p), ord(ord) {}
} res[maxN], tmp[maxN]; bool eaten[maxN];
complex <double> p[maxN], v[maxN];
double w[maxN], V, deltaw, T;
int n, cnt;
 
inline double sqr(double x) {return x * x;}
 
inline double sqr(complex <double> z)
{return sqr(real(z)) + sqr(imag(z));}
 
inline double solve(complex <double> p,
					complex <double> v,
					complex <double> O)
{
	double a = sqr(v) - sqr(V),
	b = -2 * (real(v) * real(O - p) + imag(v) * imag(O - p)),
	c = sqr(p - O),
	delta = sqr(b) - 4 * a * c;
	if (delta < -zero) return INF;
	if (fabs(a) < zero)
		return (b > -zero) ? INF : (-c / b);
	double ans = INF,
		   x1 = (-b - sqrt(delta)) / (2 * a),
		   x2 = (-b + sqrt(delta)) / (2 * a);
	if (x1 > -zero) ans = x1;
	if (x2 > -zero && x2 < ans) ans = x2;
	return ans;
}
 
void Dfs(int i, double w0, double t, complex <double> p0)
{
	for (int j = 1; j < n + 1; ++j)
	if (!eaten[j] && w[j] < w0)
	{
		double ths = solve(p[j] + t * v[j], v[j], p0);
		if (t + ths - T > zero) continue;
		complex <double> pos = p[j] + (t + ths) * v[j];
		eaten[j] = 1;
		tmp[i] = Res(t + ths, pos, j);
		Dfs(i + 1, w0 + w[j], t + ths, pos);
		tmp[i] = Res(0, 0, 0);
		eaten[j] = 0;
	}
	if (w0 - w[0] > deltaw)
	{
		deltaw = w0 - w[0];
		for (cnt = 0; tmp[cnt].t > zero; ++cnt)
			res[cnt] = tmp[cnt];
	}
	return;
}
int main()
{
	freopen("nemo2.in", "r", stdin);
	freopen("nemo2.out", "w", stdout);
	scanf("%lf%lf%lf%lf%lf%d", w + 0, &V, &T, &p[0].real(), &p[0].imag(), &n);
	for (int i = 1; i < n + 1; ++i)
		scanf("%lf%lf%lf%lf%lf", w + i, &p[i].real(), &p[i].imag(), &v[i].real(), &v[i].imag());
	Dfs(0, w[0], 0, p[0]);
	printf("%d\n%.9lf\n", cnt, deltaw);
	for (int i = 0; i < cnt; ++i)
		printf("%.9lf %.9lf %.9lf %d\n", res[i].t, res[i].p.real(), res[i].p.imag(), res[i].ord);
	return 0;
}

第三组数据小虾的体重有规律,按顺序吃就是了,附程序:

​
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <complex>
 
using namespace std;
 
const int maxN = 10010;
const double zero = 1e-12, INF = 1e198;
struct Res
{
	double t; complex <double> p; int ord; Res() {}
	Res(double t, complex <double> p, int ord):
		t(t), p(p), ord(ord) {}
} res[maxN]; bool eaten[maxN];
complex <double> p[maxN], v[maxN];
double w[maxN], V, deltaw, T;
int ord[maxN], n, cnt;
 
inline bool cmp(const int &a, const int &b)
{return w[a] < w[b];}
 
inline double sqr(double x) {return x * x;}
 
inline double sqr(complex <double> z)
{return sqr(real(z)) + sqr(imag(z));}
 
inline double solve(complex <double> p,
					complex <double> v,
					complex <double> O)
{
	double a = sqr(v) - sqr(V),
	b = -2 * (real(v) * real(O - p) + imag(v) * imag(O - p)),
	c = sqr(p - O),
	delta = sqr(b) - 4 * a * c;
	if (delta < -zero) return INF;
	if (fabs(a) < zero)
		return (b > -zero) ? INF : (-c / b);
	double ans = INF,
		   x1 = (-b - sqrt(delta)) / (2 * a),
		   x2 = (-b + sqrt(delta)) / (2 * a);
	if (x1 > -zero) ans = x1;
	if (x2 > -zero && x2 < ans) ans = x2;
	return ans;
}
 
int main()
{
	freopen("nemo3.in", "r", stdin);
	freopen("nemo3.out", "w", stdout);
	scanf("%lf%lf%lf%lf%lf%d", w + 0, &V, &T, &p[0].real(), &p[0].imag(), &n);
	for (int i = 1; i < n + 1; ord[i] = i, ++i)
		scanf("%lf%lf%lf%lf%lf", w + i, &p[i].real(), &p[i].imag(), &v[i].real(), &v[i].imag());
	sort(ord + 1, ord + n + 1, cmp);
	for (double t = 0; T - t > zero;)
	{
		static int i = 0; ++i; if (i > n) break;
		double Min = solve(p[ord[i]] + t * v[ord[i]], v[ord[i]], p[0]);
		int pos = ord[i];
		if (fabs(Min - INF) < zero) break;
		if (T - (t += Min) < -zero) break;
		w[0] += w[pos]; deltaw += w[pos]; eaten[pos] = 1;
		res[cnt++] = Res(t, p[0] = p[pos] + t * v[pos], pos);
	}
	printf("%d\n%.9lf\n", cnt, deltaw);
	for (int i = 0; i < cnt; ++i)
		printf("%.9lf %.9lf %.9lf %d\n", res[i].t, res[i].p.real(), res[i].p.imag(), res[i].ord);
	return 0;
}

​

第四组数据中所有小虾静止不动且在一条直线上,据说是区间动态规划,方法至今未知。

第五、六组数据中所有小虾都在高速向下掉,而Nemo的移动速度很小,可以近似看作Nemo在只能水平移动的情况下去接住小虾来吃。

先将小虾按竖直方向排序,然后进行一下操作。

设f[i]表示前i个小虾中恰好第i个被吃所能得到的最大收益,只需要一个n^2的动态规划即可求解。

附程序:

​
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <complex>
 
using namespace std;
 
const int maxN = 10010;
const double zero = 1e-12, INF = 1e198;
struct Res
{
	double t; complex <double> p; int ord; Res() {}
	Res(double t, complex <double> p, int ord):
		t(t), p(p), ord(ord) {}
} res[maxN]; bool eaten[maxN];
complex <double> p[maxN], v[maxN];
double f[maxN], w[maxN], V, deltaw, T;
int ord[maxN], g[maxN], n, cnt;
 
inline bool cmp(const int &a, const int &b)
{return imag(p[a]) < imag(p[b]);}
 
void calc(int i)
{
	if (g[i]) calc(g[i]);
	res[cnt++] = Res(imag(p[i]) / 1000, p[i], i);
	deltaw += w[i];
	return;
}
 
int main()
{
	freopen("nemo5.in", "r", stdin);
	freopen("nemo5.out", "w", stdout);
	scanf("%lf%lf%lf%lf%lf%d", w + 0, &V, &T, &p[0].real(), &p[0].imag(), &n);
	for (int i = 1; i < n + 1; ord[i] = i, ++i)
		scanf("%lf%lf%lf%lf%lf", w + i, &p[i].real(), &p[i].imag(), &v[i].real(), &v[i].imag());
	sort(ord + 1, ord + n + 1, cmp);
	int st = 1;
	while (imag(p[ord[st]]) / 1000 - real(p[ord[st]]) / V < -zero) ++st;
	f[ord[st]] = w[ord[st]];
	for (int i = 1; i < st; ++i) f[ord[i]] = -INF;
	for (int i = 0; i < n; ++i)
	if (f[ord[i]] > -INF)
	for (int j = i + 1; j < n + 1; ++j)
	{
		if (imag(p[ord[j]] - p[ord[i]]) / 1000 - fabs(real(p[ord[i]] - p[ord[j]])) / V > -zero)
		if (f[ord[i]] + w[ord[j]] > f[ord[j]])
			f[ord[j]] = f[ord[i]] + w[ord[j]],
			g[ord[j]] = ord[i];
	}
	int pos = ord[n];
	for (int i = 1; i < n + 1; ++i) if (f[i] > f[pos]) pos = i;
	calc(pos);
	printf("%d\n%.9lf\n", cnt, deltaw);
	for (int i = 0; i < cnt; ++i)
		printf("%.9lf %.9lf %.9lf %d\n", res[i].t, res[i].p.real(), 0., res[i].ord);
	return 0;
}

​

第七、八组数据中可以发现小虾的位置呈现数字三角形的形状,只需要按数字三角形的方法进行动态规划即可。

附程序:

​
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <complex>
 
using namespace std;
 
const int maxN = 2010, INF = 0x3f3f3f3f;
const double zero = 1e-12;
struct Res
{
	double t; complex <int> p; int ord; Res() {}
	Res(double t, complex <int> p, int ord):
		t(t), p(p), ord(ord) {}
} res[maxN], tmp[maxN]; bool eaten[maxN];
complex <int> p[maxN], v[maxN];
double w[maxN], deltaw, V, T, f[maxN][maxN];
int ord[maxN][maxN], g[maxN], n, cnt;
 
inline double sqr(double x) {return x * x;}
 
inline double sqr(complex <double> z)
{return sqr(real(z)) + sqr(imag(z));}
 
int main()
{
	freopen("nemo8.in", "r", stdin);
	freopen("nemo8.out", "w", stdout);
	scanf("%lf%lf%lf%d%d%d", w + 0, &V, &T, &p[0].real(), &p[0].imag(), &n);
	for (int i = 1; i < n + 1; ++i)
		scanf("%lf%d%d%d%d", w + i, &p[i].real(), &p[i].imag(), &v[i].real(), &v[i].imag());
	for (int i = 1; i < n + 1; ++i)
		ord[real(p[i])][imag(p[i])] = i;
	int i = n;
	for (; i; --i)
	{
		f[real(p[i])][imag(p[i])] = w[i];
		if (imag(p[i - 1]) < imag(p[i])) break;
	}
	while (--i)
	{
		int x = real(p[i]), y = imag(p[i]), ths = ord[x][y];
		if (f[x - 1][y + 1] > f[x + 1][y + 1])
		{
			f[x][y] = w[i] + f[x - 1][y + 1];
			g[ths] = ord[x - 1][y + 1];
		}
		else
		{
			f[x][y] = w[i] + f[x + 1][y + 1];
			g[ths] = ord[x + 1][y + 1];
		}
	}
	double t = 0;
	res[cnt++] = Res(t = abs(p[1] - p[0]) / V, p[1], 1);
	for (int ths = 1; g[ths]; ths = g[ths])
		res[cnt++] = Res(t += abs(complex <double> (real(p[g[ths]] - p[ths]), imag(p[g[ths]] - p[ths]))) / V, p[g[ths]], g[ths]);
	for (int i = 0; i < cnt; ++i) deltaw += w[res[i].ord];
	printf("%d\n%lf\n", cnt, deltaw);
	for (int i = 0; i < cnt; ++i)
		printf("%.9lf %d %d %d\n", res[i].t, res[i].p.real(), res[i].p.imag(), res[i].ord);
	return 0;
}

​

第九组数据中所有小虾都静止不动,简单的贪心就可以过。

第十组数据可能就只有随机化贪心能够解决了……

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

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

相关文章

如何在 Windows 11 启用 Hyper-V

准备在本机玩一下k8s&#xff0c;需要先启用 Hyper-V&#xff0c;谁知道这一打开&#xff0c;没有 Hyper-V选项&#xff1a; 1、查看功能截图&#xff1a; 2、以下文件保存记事本&#xff0c;然后重命名为*.bat pushd "%~dp0" dir /b %SystemRoot%\servicing\Packa…

常用的MySQL 优化方法

数据库优化一方面是找出系统的瓶颈&#xff0c;提高MySQL数据库的整体性能&#xff0c;而另一方面需要合理的结构设计和参数调整&#xff0c;以提高用户的相应速度&#xff0c;同时还要尽可能的节约系统资源&#xff0c;以便让系统提供更大的负荷。   本文我们来谈谈项目中常用…

maven中的 type ,scope的作用

dependency为什么会有type为pom&#xff0c;默认的值是什么&#xff1f; dependency中type默认为jar即引入一个特定的jar包。那么为什么还会有type为pom呢?当我们需要引入很多jar包的时候会导致pom.xml过大&#xff0c;我们可以想到的一种解决方…

Linux指令-2

文章目录 一、 m a n man man [选项] 命令1、功能&#xff1a;2、常用选项&#xff1a;3、运用实例 二、 c p cp cp [选项] 源文件/目录 目标文件/目录1、功能&#xff1a;2、常用选项&#xff1a;3、运用实例 三、 m v mv mv [选项] 源文件/目录 目标文件/目录1、功能…

PySide6/PyQT多线程之 编程入门指南:基础概念和最佳实践

前言 本篇文章介绍 PySide6/PyQT多线程编程的基本概念&#xff0c;用到的知识点&#xff0c;以及PySide6/PyQT多线程的基本使用。 看多线程介绍&#xff0c;就看 知识点&#x1f4d6;&#x1f4d6; &#xff1b; 看多线程代码&#xff0c;就看 实现 。 知识点&#x1f4d6;&…

《手腕光电容积图智能手表对房颤检测的录制长度和其他心律失常的影响》阅读笔记

目录 一、论文摘要 二、论文十问 三、论文亮点与不足之处 四、与其他研究的比较 五、实际应用与影响 六、个人思考与启示 参考文献 一、论文摘要 本研究旨在评估手腕光电容积图&#xff08;PPG&#xff09;的定量分析是否能检测到房颤&#xff08;AF&#xff09;。使用心…

项目管理-计算专题(挣值分析)

挣值分析法 是对项目进行跟踪与预测的方法&#xff1b;项目有良好的任务细分以及合理的日程安排&#xff1b;不牵涉到复杂的数学计算&#xff1b;在软件项目管理中&#xff0c;一般以一周为单位定期进行。 项目案例 有一个砌墙项目&#xff0c;需要完成一堵长度为100米的围墙…

第二十四章 纹理贴图

通常情况下&#xff0c;3D网格模型只能展示游戏对象的几何形状&#xff0c;而表面的细节则纹理贴图提供。纹理贴图通过UV坐标“贴附”在模型的表面。当然&#xff0c;这个过程不需要我们在Unity中完成&#xff0c;而是在建模软件中完成的。通常情况下&#xff0c;我们通过3ds m…

基于matlab使用合成雷达和无线通信信号训练的语义分割神经网络执行频谱检测

一、前言 此示例展示了如何使用使用合成雷达和无线通信信号训练的语义分割神经网络执行频谱检测。经过训练的神经网络可以识别出现在相同接收频谱中的雷达和无线通信信号。此外&#xff0c;网络可以识别接收信号的占用带宽。 二、介绍 由于对更高速度和更大覆盖范围的需求不断增…

多元时间序列 | BP神经网络多变量时间序列预测(Matlab完整程序)

多元时间序列 | BP神经网络多变量时间序列预测(Matlab完整程序) 目录 多元时间序列 | BP神经网络多变量时间序列预测(Matlab完整程序)预测结果评价指标基本介绍程序设计参考资料预测结果 评价指标 训练集数据的R2为:0.99805 测试集数据的R2为:0.98351 训练集数据的MAE为:…

小黑子—Java从入门到入土过程:第八章

Java零基础入门8.0 Java系列第八章1. 双列集合 Map1.1 Map 集合中常见的API1.2 Map 集合的遍历方式1.2 - I 第一种遍历方式&#xff1a;键找值KeySet 方法1.2 - II 第二种遍历方式&#xff1a;键值对 entrySet 方法1.2 - III 第三种遍历方式&#xff1a;lambda表达式 1.3 HashM…

沁恒 CH32V208(三): CH32V208 Ubuntu22.04 Makefile VSCode环境配置

目录 沁恒 CH32V208(一): CH32V208WBU6 评估板上手报告和Win10环境配置沁恒 CH32V208(二): CH32V208的储存结构, 启动模式和时钟沁恒 CH32V208(三): CH32V208 Ubuntu22.04 Makefile VSCode环境配置 硬件部分 CH32V208WBU6 评估板WCH-LinkE 或 WCH-Link 硬件环境与Windows下…

【51单片机】数码管显示(样例展示以及异常分析)

🎊专栏【51单片机】 🍔喜欢的诗句:更喜岷山千里雪 三军过后尽开颜。 🎆音乐分享【如愿】 大一同学小吉,欢迎并且感谢大家指出我的问题🥰 ⭐数码管 比如要显示“6”,那么下面图片中,AFEDCG=1,B=0 对应到数码管上,就是 ⭐原理 🎊P22~P24控制LED1~

玩转ChatGPT:吴恩达/OpenAI合作教程《面向开发者的ChatGPT提示工程》

一、写在前面 最近&#xff0c;吴恩达与CloseOpenAI合作出了一个教程《面向开发者的ChatGPT提示工程》&#xff0c;第一时间就观摩了&#xff0c;有些体会&#xff0c;现在把个人觉得有意思的搬运过来。 我的机器学习入门就是看的吴恩达的教程&#xff01;大佬长得像冯巩&…

解决Element-UI清空表单及验证不生效的问题

问题描述 由于我将编辑与新增时&#xff0c;表单使用的是同一个data中的数据&#xff0c;这就导致出现了我点击了编辑后&#xff0c;再次点击新增时&#xff0c;出现了数据依旧是刚才编辑表单中的数据。 解决办法 尝试一&#xff08;不推荐&#xff09; 通过手动给表单中的…

【五一创作】版本控制-从零开始学Git-01什么是Git

一、版本控制 1.1 概念 什么是"版本控制"&#xff1f;版本控制就是一种记录一个或多个文件内容变化、以便开发者 或者其他用户将来对特定版本的文件进行查阅、备份、恢复等操作的系统&#xff0c;即版本控制系统。(VCS,version control system)。 1.2 为何需要版本…

15-4-线程-线程同步之互斥量加锁解锁

一、概念 互斥量&#xff1a;互斥量&#xff08;mutex&#xff09;从本质上来说是一把锁&#xff0c;在访问共享资源前对加互斥量&#xff08;实现加锁&#xff09;&#xff0c;在访问完成后释放互斥量&#xff08;实现解锁&#xff09;。 加锁后&#xff0c;任何其他试图再次…

SpringMvc拦截器使用介绍

文章目录 拦截器拦截器基本介绍拦截器快速入门拦截器参数 拦截器 拦截器基本介绍 拦截器&#xff08;Interceptor&#xff09;是一种动态拦截方法调用的机制&#xff0c;在SpringMVC中动态拦截控制器方法的执行 作用&#xff1a; 在指定的方法调用前后执行预先设定的代码 阻…

详解MySQL索引

目录 1.什么是索引 2.使用索引的优缺点 3.索引的数据结构 4.索引的分类 5.索引的操作 6.复合索引的数据结构 1.什么是索引 当我们想在一本书里面找到具体的章节的时候&#xff0c;最快的办法是去查看这本书的目录&#xff0c;索引就类似于数据库中存储的数据的目录&…

LeetCode-1033. 移动石子直到连续

题目链接 LeetCode-1033. 移动石子直到连续 题目描述 题解 题解一&#xff08;Java&#xff09; 作者&#xff1a;仲景 这题目挺难懂的&#xff0c;得画画图才能更好的理解 这也是LeetCode的尿性&#xff0c;习惯了&#xff0c;非得整这种别人看不懂的鸟语 你可以这样理解&a…