裸设备 linux,Linux平台下裸设备的绑定:
Description
Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak.
Input
The input contains exactly one test case. The first line of input contains three positive integers n (n ≤ 30), k (k ≤ 109) and m (m < 104). Then follow n lines each containing n nonnegative
integers below 32,768, giving A’s elements in row-major order.
Output
Output the elements of S modulo m in the same way as A is given.
Sample Input
2 2 4
0 1
1 1
Sample Output
1 2
2 3
题解:
| A+A2+A3+……Ak | |A A| (k-1)次方 | A |
| | = | | | |
| E | |0 E| | E |代码:
#include
#include
#include
using namespace std;
struct mat
{
int t[65][65];
void set()
{
memset(t,0,sizeof(t));
}
} a,b;
mat multiple(mat a,mat b,int n,int p)
{
int i,j,k;
mat temp;
temp.set();
for(i=0; i
for(j=0; j
{
if(a.t[i][j]>0)
for(k=0; k
temp.t[i][k]=(temp.t[i][k]+a.t[i][j]*b.t[j][k])%p;
}
return temp;
}
mat quick_mod(mat b,int n,int m,int p)
{
mat t;
t.set();
for(int i=0;i
while(m)
{
if(m&1)
{
t=multiple(t,b,n,p);
}
m>>=1;
b=multiple(b,b,n,p);
}
return t;
}
void init(int n,int m,int p)
{
a.set();
b.set();
for(int i=0;i
for(int j=0;j
{
scanf("%d",&b.t[i][j]);
b.t[i][j+n]=b.t[i][j];
a.t[i][j]=b.t[i][j];
}
for(int i=n;i<2*n;i++)
for(int j=n;j<2*n;j++)
if(i==j) b.t[i][j]=1;
for(int i=n;i<2*n;i++)
for(int j=0;j
if(j+n==i) a.t[i][j]=1;
b=quick_mod(b,2*n,m-1,p);
mat temp;
temp.set();
for(int i=0; i
for(int j=0; j
{
for(int k=0; k<2*n; k++)
temp.t[i][j]=(temp.t[i][j]+b.t[i][k]*a.t[k][j])%p;
}
for(int i=0;i
{
for(int j=0;j
printf("%d ",temp.t[i][j]);
puts("");
}
}
int main()
{
int n,m,p;
while(cin>>n>>m>>p)
{
init(n,m,p);
}
return 0;
}
原文:http://blog.csdn.net/panfelix/article/details/26480509
裸设备 linux,Linux平台下裸设备的绑定:相关推荐
- Linux平台下裸设备的绑定:
Linux平台下裸设备的绑定: 运用RAW绑定 方法一 raw的配置(1) [root@qs-dmm-rh2 mapper]# cat /etc/rc.local #!/bin/sh # # This ...
- Linux RH5平台下使用Oracle ASM创建数据库
一.安装配置先决条件 1.安装oracleasm支持包 创建asm数据库,首先需要ASMLib驱动程序包,可以从相关的网站下载到和操作系统对应的rpm文件,分别为oracleasm-support-2 ...
- linux pcie驱动框架_Linux设备驱动框架设计
引子 Linux操作系统的一大优势就是支持数以万计的芯片设备,大大小小的芯片厂商工程师都在积极地向Linux kernel提交设备驱动代码.能让这个目标得以实现,这背后隐藏着一个看不见的技术优势:Li ...
- 揭秘 | 阿里云IoT物联网平台亿级设备接入方案大揭秘
一.前言 不同的接入层 互联网的产品基本都需要解决终端的接入问题,每个接入层会因为终端数量.终端能力.网络环境等不同的因素有各自的设计特性,比如:淘宝网需要解决海量短连接问题.微信需要解决海量长连接问 ...
- linux裸设备文件系统,Linux当中的文件系统
1. 设备专用文件(设备文件) 设备专用文件与系统的某个设备相对应.在内核中,每种设备类型都有阈值向对应的设备驱动程序,用来处理设备的所有I/O请求.可以将设备划分为字符设备和块设备两种. 每个设备文 ...
- 六、linux虚拟平台设备注册
一.使用到的设备结构体 注册设备使用结构体platform_device,该结构体在头文件"viminclude/linux/platform_device.h"中.头文件中也有注 ...
- linux设备驱动——andriod平台wlan驱动
转自 :http://blog.chinaunix.net/space.php?uid=22278460&do=blog&cuid=2186191 linux设备驱动--andriod ...
- Linux下PCI设备驱动程序开发[转]
PCI是一种广泛采用的总线标准,它提供了许多优于其它总线标准(如EISA)的新特性,目前已经成为计算机系统中应用最为广泛,并且最为通用的总线标准.Linux的内核能较好地支持PCI总线,本文以Inte ...
- mtd分区创建linux,浅析linux下mtd设备onenand存储器的分区和节点创建流程及yaffs2文件系统挂载...
浅析linux下mtd设备onenand存储器的分区和节点创建流程及yaffs2文件系统挂载 在arch/arm/mach-pxa/luther.c这个产品平台文件中,即: MACHINE_START ...
最新文章
- 拼多多,一面,i++ 是线程安全的吗?一脸蒙逼
- cogs 610. 数对的个数
- Android事件分发溯源详解
- jquery ajax请求 清除缓存
- Linux复位usb hub,Linux USB subsystem --- USB Hub initialize
- nginx将9000端口转发映射至 8080
- [react] 如何解决引用类型在pureComponent下修改值的时候,页面不渲染的问题?
- 阿里云MVP第六期发布——覆盖全球20多个国家和地区,成为数字化转型的中坚力量...
- python日志模块----logging
- 【Android】Mac安装EasyTether导致无法识别设备的问题
- Android录音采样率限制问题(十一)
- 【FastDFS】FastDFS在CentOS的搭建
- 小米9 MIUI12.5 红米 K40s MIUI13.0.10 安装谷歌框架
- 解决Windows与Ubuntu双系统时间同步问题
- his使用-重置密码
- 数据分析师会被算法取代么?
- 【STM32F429的DSP教程】第25章 DSP变换运算-快速傅里叶变换原理(FFT)
- might和could的区别用法_情态动词could,would,might等的用法区别
- Python基础入门9:字符串1,字符串的驻留
- 计算两个日期的相隔天数
热门文章
- 什么是标签传播算法?为什么要使用标签传播算法?如何使用?
- 使用KNN模型进行多标签分类实战(Multilabel Classification)
- 三代测序原理与数据文件简介(SMRT+Nanopore)
- Oxford Nanopore sequencing, hybrid error correction, and de novo assembly of a eukaryotic genome
- python PDF 转 图片
- 【Vue】宝塔面板服务器配置Vue项目
- 二值网络--Bi-Real Net: Enhancing the Performance of 1-bit CNNs
- 数学知识--Methods for Non-Linear Least Squares Problems(第一章)
- 【opus源码分析】celt_fir5函数
- 报错解决:undefined reference to `snappy::MaxCompressedLength(unsigned long)'