博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 4920矩阵连乘
阅读量:4205 次
发布时间:2019-05-26

本文共 1448 字,大约阅读时间需要 4 分钟。

Given two matrices A and B of size n×n, find the product of them. 
bobo hates big integers. So you are only asked to find the result modulo 3.
Input
The input consists of several tests. For each tests: 
The first line contains n (1≤n≤800). Each of the following n lines contain n integers -- the description of the matrix A. The j-th integer in the i-th line equals A 
ij. The next n lines describe the matrix B in similar format (0≤A 
ij,B 
ij≤10 
9).
Output
For each tests: 
Print n lines. Each of them contain n integers -- the matrix A×B in similar format.
Sample Input
10120 12 34 56 7
Sample Output
00 1 2 1 ////  main.cpp//  160929////  Created by liuzhe on 17/3/30.//  Copyright © 2016年 my_code. All rights reserved.////#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ll long long#define mod 3using namespace std;ll a[805][805],b[805][805],c[805][805];int main(){ int n; while(~scanf("%d",&n)) //while(cin>>n) { for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) { scanf("%lld",&a[i][j]); a[i][j]=a[i][j]%mod; } for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) { scanf("%lld",&b[i][j]); b[i][j]=b[i][j]%mod; } memset(c,0,sizeof(c)); for(int i=1;i<=n;i++) { for(int k=1;k<=n;k++) { for(int j=1;j<=n;j++) { c[i][j]+=(a[i][k]*b[k][j]); } //c[i][j]=c[i][j]%mod; } } for(int i=1;i<=n;i++) { for(int j=1;j

转载地址:http://dvali.baihongyu.com/

你可能感兴趣的文章
adb常用命令
查看>>
通过LR监控Linux服务器性能
查看>>
通过FTP服务的winsockes录制脚本
查看>>
LRwinsocket协议测试AAA服务器
查看>>
Net远程管理实验
查看>>
反病毒专家谈虚拟机技术 面临两大技术难题
查看>>
几种典型的反病毒技术:特征码技术、覆盖法技术等
查看>>
性能测试一般过程与LR性能测试过程
查看>>
Software Security Testing软件安全测试
查看>>
SQL注入漏洞全接触--进阶篇
查看>>
SQL注入漏洞全接触--高级篇
查看>>
SQL注入法攻击一日通
查看>>
菜鸟入门级:SQL注入攻击
查看>>
用vbs来写sql注入等80端口的攻击脚本
查看>>
C# 检查字符串,防SQL注入攻击
查看>>
关于对SQL注入80004005 及其它错误消息分析
查看>>
即时通软件性能测试(与宴宾的对话)
查看>>
应用软件性能测试的艺术(翻译)——序
查看>>
高级性能测试(翻译)
查看>>
Web安全测试解决方案
查看>>