51nod 1137 矩阵乘法

AI嵌入式系统测试:从确定性验证到概率性评估的体系构建 软件测试是保障系统质量的关键环节,其核心在于验证功能是否符合预期。传统嵌入式测试聚焦于确定性逻辑,通过代码覆盖、边界值分析等方法确保时序、内存等指标的精确性。随着人工智能技术的普及,深度学习模型以其概率性输出和复杂非线性映射的特性,为嵌入式系统带来了新的能力,也彻底改变了测试的范式。AI模型的‘黑盒’特性使得测试目标从‘绝对正确’转向‘置信度满足’,并催生了准确率、F1分数等新指标。在工程实践中,这种融合要求测试体系必须扩展维度,将数据质量、模型量化损失、资源约束下的精度与性能权衡纳入核心考量。尤其在嵌入式 阅读详情

 

给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。

Input

第1行:1个数N,表示矩阵的大小(2 <= N <= 100)
第2 - N + 1行,每行N个数,对应M1的1行(0 <= M1[i] <= 1000)
第N + 2 - 2N + 1行,每行N个数,对应M2的1行(0 <= M2[i] <= 1000)

Output

输出共N行,每行N个数,对应M1 * M2的结果的一行。

Input示例

2
1 0
0 1
0 1
1 0

Output示例

0 1
1 0

 

水题,只是接触下矩阵的运算是怎么运行的,这个百度了解。

可以不用数组保存结果,运算完一个数就输出。

 

#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
int main()
{
     int a[100][100],b[100][100],temp,ans;
     int n,i,j;
     cin>>n;   //输入矩阵大小
     for(i=0;i<n;i++)     //输入A数组
        for(j=0;j<n;j++)
        cin>>a[i][j];
     for(i=0;i<n;i++)    //输入B数组
        for(j=0;j<n;j++)
        cin>>b[i][j];
         for(i=0;i<n;i++)
         {
        for(j=0;j<n;j++)  //矩阵运算
        {
            ans=0;
            for(temp=0;temp<n;temp++)
            ans+=a[i][temp]*b[temp][j];
            cout<<ans<<" ";
        }
        cout<<endl;
         }
    return 0;
}

 

 

 

 

 

SpringBoot整合oceanbase,实现oracle无缝切换到oceanbase 随着去“IOE”化的潮流,近些年来,许多与国家相关的项目不约而同到地往”国产化“方向靠拢,不可避免地,一些项目可能需要进行数据库迁移。 阅读详情

相关推荐

软件各项会议评审意见模版

读梅老师主编的书,觉得评审意见模板很有参考价值和实用价值,帮梅老师安利一波,顺便记一下笔记。 《系统/子系统规格说明》评审意见模板 20XX年XX月XX日,XXX(主管机关)在XXX(会议地点)主持召开了“《XXX(产品名称)系统规格说明》评审会”。参加会议的有XXX机关,XXX院校,XXX研究所共XX名代表(名单见附件1),会议成立了评审组(名单见附件2),听取了XXX(单位)做的《XXXX报告》。经讨论质询,形成评审意见如下: 系统规格说明对系统的研制目标和范围、工作状态、运行方式以及所要满足的能力需

赵星汉同学的博客 1万+

敲打51nod服务器的一天天「python-requests」

这几天整个机房都在刷51nod的题。于是,我就做了一点点python的插件供我们逍遥 1 自动抓取做题记录 每天都要用手统计做题记录,还不如让py抓呢。 于是,我就看了看51nod的api。发现找不到。 于是,我也就抓了一抓,于是发现了在每一个目录下去掉.html后缀就可以获得数据网页。于是就可以做出这样:虽然一开始有锅( 后来就 改掉了。 import requests import time r=requests.session() def find_lastAC(pid,uid): #返回最早A

Lotuses的博客 2288

Unity3D安装:离线安装 Unity

Unity 下载助手 (Download Assistant) 支持离线部署。在这种部署方式中,可下载用于安装 Unity 的所有文件,然后生成脚本以便在未接入互联网的其他计算机上重复相同的安装。运行下载助手,并在一台计算机上正常安装 Unity。此计算机必须有足够的可用磁盘空间来下载所有文件。单击下拉选单并选择 __Custom__,然后选择要将文件下载到的位置。打开 PC 的文件管理器,导航到之前指定的自定义位置文件夹,然后在该文件夹内查找。整理翻译,转载请注明出处!

ygtu2018的博客 3254

51Nod-1137-矩阵乘法

1137 矩阵乘法 题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1137 题目 给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。 Input 第1行:1个数N,表示矩阵的大小(2 第2 - N + 1行,每行N个数,对应M1的1行(0 第N + 2 - 2N + 1行,每行N

sortmin的博客 348

Spring Boot 实现多图片上传并回显,涨姿势了~

上传 Controller的代码非常简单,由于用了SpringMVC框架,所以直接用MultipartFile来接即可。由于是多图片上传所以用数组来接。此处应该注意参数名应该和<input>中的name值相对应: @RequestMapping("/pic") @ResponseBody publicResponseEntity<String>pic(MultipartFile[]pictures)throwsException{ ResponseEnti...

weixin_54556126的博客 893

学习Ultralytics (下载)

Ultralytics由创立,最初是为了简化目标检测模型的开发和应用,专注于构建高效、易用、性能卓越的深度学习框架。其主要产品之一是 YOLO 系列模型,尤其是最新的YOLOv5和YOLOv8,因其在精度、速度和可扩展性方面的出色表现而广受欢迎。

2301_76846375的博客 2864

51nod 1137 矩阵乘法(矩阵乘法)

1137 矩阵乘法 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题  收藏  关注 给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。 Input 第1行:1个数N,表示矩阵的大小(2 <= N <= 100) 第2 - N + 1行,每行N个数,对应M1的1行(0 <= M1

a617350885的专栏 609

使用Android GPS api 实现一个轨迹记录的小功能

引入 市场上的跑步软件已经是非常多了,如咕咚和悦跑圈还有其他,很多大厂也在涉足这个方面。而最简单的运动跑步,最近几年也因简单,不限场地,运动效果出众备受大众喜欢。 我的这篇文章的内容很多也是从网上学习其他的博客内容,外加利用android自身的提供的api实现的,希望能对有这方面需求的朋友有所帮助。 介绍 先上两张图,界面比较丑,不过一些数据基本都有了,这个图片是临时要用截取的,所以轨迹线很短,之前

尝试着去了解代码 1万+

51nod 1137 矩阵乘法(矩阵快速乘法)

1137 矩阵乘法 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题  收藏  关注 给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。 Input 第1行:1个数N,表示矩阵的大小(2 <= N <= 100) 第2 - N + 1行,每行N个数,对应M1的1行(0 <= M1

叶孤心的专栏 1136

OpenAI Error: 403 Country, region, or territory not supported [Python]

从OpenAI的API服务中获取数据时,由于你所在的国家、地区或领土不被支持,因此请求被拒绝了

suiusoar 5666

【项目实战】AES实施应符合NIST密码算法验证程序

AES由美国国家标准与技术研究院(NIST)制定。NIST是负责开发和维护美国政府使用的技术标准的机构,包括加密标准。

奶爸的编程之路,也就一周冷个三天 765

POJ 3044 City Skyline 单调栈+题意

City Skyline Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3083   Accepted: 1412 Descri...

pxlsdz的博客 631

PyTorch 面试题及详细答案120题(54-70)-- 模型训练与评估

本文介绍了PyTorch模型训练的基本流程和核心概念。主要内容包括: 模型训练基本流程:通过代码示例展示了数据准备、模型定义、损失函数和优化器选择、训练循环(前向传播、反向传播、参数更新)的完整过程,并包含验证集评估的实现。 训练过程中的关键概念: Epoch:完整遍历一次训练集 Batch:将数据分成小批次 Iteration:一个Batch的参数更新过程 三者关系:1 Epoch = N/B Batch = N/B Iteration(N为样本数,B为batch_size) PyTorch数据加载机制:

大剑师兰特的GIS世界 489

51nod 1137 矩阵乘法

1137 矩阵乘法 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。Input第1行:1个数N,表示矩阵的大小(2 &lt;= N &lt;= 100) 第2 - N + 1行,每行N个数,对应M1的1行(0 &lt;= M1[i] &lt;= 1000) 第N + 2 - 2N + 1行,每行N...

BBHHTT的博客 242

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

51Nod_1137 矩阵乘法

                                             51Nod_1137 矩阵乘法                                          http://www.51nod.com/Challenge/Problem.html#!#problemId=1137     题目 给出2个N * N的矩阵M1和M2,输出2个矩阵相...

逐梦者 385

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

51Nod 1137 矩阵乘法

1137 矩阵乘法 给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。 输入 第1行:1个数N,表示矩阵的大小(2 <= N <= 100) 第2 - N + 1行,每行N个数,对应M1的1行(0 <= M1[i] <= 1000) 第N + 2 - 2N + 1行,每行N个数,对应M2的1行(0 <= M2[i] <= 1000) 输出 ...

agang2007的博客 155

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

51Nod 1137矩阵乘法

1137 矩阵乘法 给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。 输入 第1行:1个数N,表示矩阵的大小(2 <= N <= 100) 第2 - N + 1行,每行N个数,对应M1的1行(0 <= M1[i] <= 1000) 第N + 2 - 2N + 1行,每行N个数,对应M2的1行(0 <= M2[i] <= 1000) ...

qq_28640193的博客 192

51NOD 1137 矩阵乘法

1137 矩阵乘法 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。 Input 第1行:1个数N,表示矩阵的大小(2<=N<=100) 第2-N+1行,每行N个数,对应M1的1行(0<=M1[i]&l...

aboc43983的博客 231

【51Nod】1137 矩阵乘法

题意给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。题意由于n的大小只有100,所以可以直接计算。参考代码#include <bits/stdc++.h> using namespace std; int a[101][101],b[101][101],c[101][101]; int main(){ int n; while (cin>>n){ for

JinbaoSite 1000
上一篇: 51nod 1019 逆序数 (分治)
下一篇: 51nod 1242 斐波那契数列的第N项
Zero丶圈圈
博客等级 码龄9年 6粉丝 46原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值