Day52:2026年3月20日打卡

一、上机打卡

1.1 矩阵面积交

1.1.1 题目

 平面上有两个矩形,它们的边平行于直角坐标系的X轴或Y轴。对于每个矩形,我们给出它的一对相对顶点的坐标,请你编程算出两个矩形的交的面积。

  输入仅包含两行,每行描述一个矩形。

  在每行中,给出矩形的一对相对顶点的坐标,每个点的坐标都用两个绝对值不超过10^7的实数表示。

  输出仅包含一个实数,为交的面积,保留到小数后两位。

输入范例

1 1 3 3

2 2 4 4

输出范例

1.00

1.1.2 总结

两个矩形分别定义4个变量来表示矩形边界

cpp 复制代码
double x1_min, x1_max, y1_min, y1_max; //矩阵1边界
double x2_min, x2_max, y2_min, y2_max; //矩阵2边界

踩过的坑:

cpp 复制代码
//坐标大小与输入顺序无关,不能这样写:
cin >> x1_min >> y1_min >> x1_max >> y1_max;
cin >> x2_min >> y2_min >> x2_max >> y2_max;

然后计算相交矩阵的边界:

上边界为两个矩形上边界的最小值;

下边界为两个矩阵下边界的最大值;

左边界为两个矩形左边界的最大值;

右边界为两个矩形右边界的最小值;

如果满足上边界大于下边界坐标,左边界坐标小于右边界坐标,则说明存在相交矩阵。

1.1.3 代码

cpp 复制代码
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {

	double x1, x2, y1, y2; //用于接收两个点的坐标
	

	double x1_min, x1_max, y1_min, y1_max; //矩阵1边界
	double x2_min, x2_max, y2_min, y2_max; //矩阵2边界

	/*
		坐标大小与输入顺序无关,不能这样写:
		cin >> x1_min >> y1_min >> x1_max >> y1_max;
		cin >> x2_min >> y2_min >> x2_max >> y2_max;
	*/

	//输入矩阵1的坐标,计算矩阵1的最大最小边界
	cin >> x1 >> y1 >> x2 >> y2;
	x1_min = min(x1, x2);
	x1_max = max(x1, x2);
	y1_min = min(y1, y2);
	y1_max = max(y1, y2);

	//输入矩阵2的坐标,计算矩阵2的最大最小边界
	cin >> x1 >> y1 >> x2 >> y2;
	x2_min = min(x1, x2);
	x2_max = max(x1, x2);
	y2_min = min(y1, y2);
	y2_max = max(y1, y2);

	
	double top = min(y1_max, y2_max);
	double bottom = max(y1_min, y2_min);
	double left = max(x1_min, x2_min);
	double right = min(x1_max, x2_max);
	double s = 0.00;
	if (top > bottom && left < right)
		s = (top - bottom) * (right - left);
	cout << fixed << setprecision(2) << s << endl;
	return 0;
}

二、翻译打卡

原文:

In recent years, pre-trained models have played an important role in artificial intelligence research. Researchers typically first train a general model using large-scale datasets and then fine-tune it on specific tasks. In this way, the model can utilize the knowledge learned during the pre-training stage to improve the performance of downstream tasks. For example, in the field of natural language processing, many language models are pre-trained on massive text corpora and achieve excellent results in tasks such as text classification, machine translation, and question answering. The pre-training and fine-tuning framework not only reduces training costs but also improves the generalization ability of models. Therefore, this approach has become an important paradigm in modern artificial intelligence research.

译文:

最近几年,预训练模型在人工智能研究领域承担了重要的角色。研究者通常使用打过莫数据集训练一般模型,然后再特殊任务上微调它。通过这种方式,模型可以使用在预训练期间学习到的知识来提升他们在下游任务的性能。例如,在自然语言处理领域,许多语言模型是在巨大规模的文本上训练好的,并且在文本分类,机器翻译和问答任务上取得了极好的结果。预训练模型和微调框架不仅仅减少了训练成本,而且还提升了模型的泛化能力。因此,这种方法在现代人工智能研究中已经成为了一个重要的典范。

相关推荐
大明者省6 小时前
WSL2 Ubuntu22.04 GPU训练环境配置指南
人工智能·算法·计算机视觉
白狐_7987 小时前
408数据结构第8章:排序②——性质对比秒杀、场景选择与外部排序
java·数据结构·算法
zander2588 小时前
LeetCode 84:柱状图中的最大矩形——单调栈如何确定左右边界
java·数据结构·算法
Shell运维手记8 小时前
Linux 常用基础命令学习笔记
linux·运维·笔记·学习·算法·github
杨航 AI8 小时前
O(n log n):线性对数原理拆解 这个是排序算法的黄金复杂度之一。
算法·排序算法
船厂电气自动化ai大模型9 小时前
AI大模型与数学 第32课 函数凹凸性与二阶导数:拐点求解、凹凸区间计算(10道二阶导数计算题)
数据结构·人工智能·python·深度学习·算法
旖旎夜光9 小时前
LeetCode 3:无重复字符的最长子串(滑动窗口) —— 题解
数据结构·c++·算法·leetcode·滑动窗口
叠层归一研究院10 小时前
AGI 系统(十一):二阶网络 — 二阶递归 × 多主体 (元符号网络)
开发语言·人工智能·算法·php·agi
zlinear数据采集卡11 小时前
D223的PWM电机控制:6路独立脉冲+加减速算法深度解析
arm开发·stm32·嵌入式硬件·算法·fpga开发·架构
杨石兴11 小时前
31、玩具MoM:用2x2矩阵串起全套流程
人工智能·算法·矩阵·电磁学