zoukankan
html css js c++ java
HDU2276 Kiki & Little Kiki 2 矩阵应用
/* s[i][j]表示i秒钟后第j个灯的情况 s[i][j] = (s[i-1][j] + s[i-1][j-1]) % 2; 令 Fn(1,len) = |s[i][0] s[i][1] …… s[i][len]| F0(1,len)为输入状态 A(len len) = |1 1 | | 1 1 | | …… | |1 1| Fn = F0 * A ^ n 这题中模板会超时,要把模板中Multiply()的%放到()外面才可以 */ #include "Mat.h" #include <iostream> using namespace std; int main() { Mat A, F; mod = 2; char str[MAX]; int n, len, i; while (scanf("%d",&n)!=EOF) { scanf("%s",str); len = strlen(str); F.ReSize(1, len); A.ReSize(len, len); for(i = 0; i < len; i++) { F.s[0][i] = str[i]-'0'; A.s[i][i] = 1; if(i==0) A.s[len-1][i] = 1; else A.s[i-1][i] = 1; } A.Er_work(n); F.Multiply(A); for(i = 0; i < len; i++) printf("%d",F.s[0][i]); printf("\n"); } return 0; }
查看全文
相关阅读:
[Angular 2] Property Binding
[Angular 2] Interpolation: check object exists
[Angular 2] @ViewChild to access Child component's method
[SVG] Simple introduce for SVG
资源-软件:资源2
SQLServer-SQLServer2017:SQLServer2017
软件-MQ-RabbitMQ:RabbitMQ
MQ:MQ(IBM MQ)
app-safeguard-record:record
引擎-JavaScript:V8(Javascript引擎)
原文地址:https://www.cnblogs.com/windmissing/p/2559893.html
最新文章
poj 2236 Wireless Network(并查集)
Java如何访问Axis2服务端
http的无状态无连接到底是什么含义
ora-28056 (Writing audit records to Windows Event Log failed)
iOS 往来--书面资料
Android数组和开发List之间的转换
SharePoint创建内容类型
【代码备忘录】VC设置您的计算机环境变量、注册表操作
设计模式6大原则(5)-得墨忒耳
矩形号码
热门文章
error: stable identifier required, but $iwC.this.$VAL4.sqlContext found.
ios 上传文件
Codeforces Round #263 (Div. 2) proA
iOS_21团购_顶部菜单和弹出菜单联动
[RxJS] Observables can complete
[Docker] Install Docker on Windows (hp) and start with Kitematic
[RxJS] Observables can throw errors
[Git] Automatically running tests before commits with ghooks
[Angular 2] Using Promise to Http
[Angular 2] *ngFor with index
Copyright © 2011-2022 走看看