进阶9:

  给定一个N阶矩阵A,输出A的M次幂(M是非负整数)
  例如:
  A =
  1 2
  3 4
  A的2次幂
  7 10
  15 22

#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.

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


Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐