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

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


相关推荐
仰泳的熊猫2 小时前
题目2279:蓝桥杯2018年第九届真题-日志统计
数据结构·c++·算法·蓝桥杯
一叶落4382 小时前
LeetCode 11:盛最多水的容器(C语言实现)
c语言·数据结构·算法·leetcode
Emilin Amy2 小时前
一台具备了“观察力”的下肢康复外骨骼机器人
算法·机器人
I_LPL2 小时前
day53 代码随想录算法训练营 图论专题7
算法·图论
_日拱一卒2 小时前
LeetCode(力扣):二叉树的后序遍历
算法·leetcode·职场和发展
Emilin Amy2 小时前
【ROS】机器人的速度/角度/力矩控制是如何实现的
c++·算法·控制·ros1/2
sali-tec2 小时前
C# 基于OpenCv的视觉工作流-章36-骨架提取
图像处理·人工智能·opencv·算法·计算机视觉
冉佳驹2 小时前
C++11 ——— 线程库与单例模式的原理、实现及线程安全设计
c++·单例模式·饿汉模式·懒汉模式·c++线程库·c++互斥锁·c++条件变量
CoovallyAIHub2 小时前
RF-DETR:最近一个月迭代 5 个版本的实时检测+分割模型
深度学习·算法·计算机视觉