【day55】

进阶9:

  给定一个N阶矩阵A,输出A的M次幂(M是非负整数)

  例如:

  A =

  1 2

  3 4

  A的2次幂

  7 10

  15 22

cpp 复制代码
#include<iostream>
#include<vector>
using namespace std;
int n;
vector<vector<int>>a;
vector<vector<int>>cur;
void news(int x, int y, vector<vector<int>>curtemp) {
	int s = 0;
	for (int i = 0; i < n; i++) {
		s += curtemp[x][i] * a[i][y];
	}
	cur[x][y] = s;
}
int main() {
	int m;
	cin >> n >> m;
	a.assign(n, vector<int>(n));//因为a是全局变量,需要在主函数n输入后重新分配大小,不然输入时会报错
	if (m == 0) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (i == j)cout << 1;
				else cout << 0;
				if (j != n - 1)cout << " ";
			}
			cout << endl;
		}
        return 0;
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	cur = a;
	vector<vector<int>>curtemp;
	for (int k = 1; k < m; k++) {
		curtemp = cur;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				news(i, j,curtemp);
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cout << cur[i][j];
			if (j != n - 1)cout << " ";
		}
		cout << endl;
	}
	return 0;
}

A serial connection is a wire or set of wires used to transfer information from the CPU to an external device such as a mouse,keyboard, modem, scanner, and some types of printers. This typeof connection transfers only one piece of data at a time, and is therefore slow. The advantage of using a serial connection is that it provides effective connections over long distances.

串行连接是一根或一组电线来传送CPU的数据到外部设备,例如鼠标、键盘、调制解调器、扫描仪和一些打印机。这种类型的连接一次只能传送一组数据,所以速度很慢。使用串行连接的优势在长距离里提供有效的连接。

  • serial connection 串行连接

A parallel connection uses multiple sets of wires to transferblocks of information simultaneously. Most scanners andprinters use this type of connection. A parallel connection ismuch faster than a serial connection, but it is limited to distancesof less than 3 m (10 ft) between the CPU and the external device.

并行连接使用多组导线同时传输信息块。大多数扫描仪和打印机都采用这种连接方式。并行连接比串行连接快得多,但它限制了CPU与外部设备之间的距离必须小于3米。

Convolutional neural networks (CNNs) are among the most important models in deep learning and are widely used in computer vision tasks such as image classification, object detection, and image segmentation. Compared with traditional fully connected neural networks, CNNs significantly reduce the number of parameters by using local connections and weight sharing, which lowers computational complexity. Convolutional layers can automatically extract features from raw images, including edges, textures, and shapes. As the number of layers increases, the model is able to learn more abstract and complex feature representations. In addition, pooling layers are usually used to reduce the spatial dimensions of feature maps, thereby decreasing computational cost and improving robustness. In practical applications, CNNs have achieved remarkable success in areas such as medical image analysis, autonomous driving, and face recognition. However, training deep convolutional neural networks often requires large amounts of labeled data and powerful computing resources, which remains an important challenge in current research.

卷基神经网络在深度学习里最重要的模型之一,被广泛应用于计算机视觉任务,例如图像分类,目标检测和图像划分。相比于传统的全连接神经网络,卷积神经网络使用本地链接和权重共享来降低计算复杂度以大幅减少数量。卷积层自动从原始图像中提取特征,包括边缘,材质和形状。随着层数的增加,模型能学习更抽象和复杂的特征表现。另外,池化层通常被用于减少特征图的空间维度,减少了计算成本和提升了鲁棒性。在实际应用中卷积神经网络在多个领域已经取得了非凡的成就,比如说医药图像分析自动驾驶和人脸识别。然而训练生成卷积神经网络通常需要大量的已标签数据以及强大的计算资源,这仍然在当前研究中是一项重要的挑战。


相关推荐
dyxal12 分钟前
eˣ 的泰勒展开式:从“化繁为简”到“万物统一”的微积分之美
算法
BetterFlow_CFD20 分钟前
COMSOL声学仿真基础知识(二)
开发语言·算法·matlab
ShineWinsu30 分钟前
对于Linux:http的解析
linux·网络·c++·网络协议·http·请求·响应
choumin10 小时前
创建型模式——工厂方法模式
c++·设计模式·工厂方法模式·创建型模式
云小逸10 小时前
【SVN 详细使用指南:从入门到团队协作】
c++·svn
徐小夕12 小时前
花了一周,3亿tokens,我开源了一款 Word 文档智能审查平台,文稿自动质检+可视化分析,告别低效人工审核
前端·算法·github
可编程芯片开发13 小时前
UPFC统一潮流控制器的simulink建模与仿真
算法
小小仙子13 小时前
矢量网络分析仪如何测试S参数的?
人工智能·算法·机器学习
code bean14 小时前
【C#】 `Channel<T>` 深度解析:生产者-消费者模式的现代解法
数据结构·c#