#include<iostream>
#include<cstring>
using namespace std; const int maxn=,mod=; struct Matrix
{
long long mat[maxn][maxn];
Matrix operator*(const Matrix& m)const///重载*运算符,使其能进行矩阵相乘的运算
{
Matrix tmp;
for(int i = ; i < maxn ; i++)
{
for(int j = ; j < maxn ; j++)
{
tmp.mat[i][j] = ;
for(int k = ; k < maxn ; k++)
{
tmp.mat[i][j] += mat[i][k]*m.mat[k][j]%mod;
tmp.mat[i][j] %= mod; }
}
}
return tmp;
}
}; Matrix m; void init()
{
m.mat[][]=;
m.mat[][]=;
m.mat[][]=;
m.mat[][]=;
} long long run(long long n)
{
Matrix ans;
memset(ans.mat,,sizeof(ans.mat));
for(int i=; i<; i++)
ans.mat[i][i]=;
while(n)
{
if(n&)
ans=ans*m;
n>>=;
m=m*m;
}
return ans.mat[][];
} int main()
{
long long n;
while(cin>>n)
{
init();
cout<<run(n)<<endl;
}
return ;
}

Plant(𝐶𝑜𝑑𝑒𝐹𝑜𝑟𝑐𝑒𝑠 − 185𝐴)的更多相关文章

  1. Codeforces Round #118 (Div. 1) A. Plant

    A. Plant 题目链接:http://codeforces.com/problemset/problem/185/A 题意:一个植物会长,一开始是一个正三角形,每过一年,一个向上的正三角形会变成三 ...

  2. Plant (矩阵快速幂)

    题目链接:http://codeforces.com/problemset/problem/185/A 题目: Dwarfs have planted a very interesting plant ...

  3. Plant Design Review Based on AnyCAD

    Plant Design Review Based on AnyCAD eryar@163.com Abstract. AVEVA Review is used to 3D model visuali ...

  4. 【BZOJ 4455】【UOJ #185】【ZJOI 2016】小星星

    http://www.lydsy.com/JudgeOnline/problem.php?id=4455 http://uoj.ac/problem/185 有一个$O(n^n)$的暴力,放宽限制可以 ...

  5. EWM一个仓库号对应ERP多个PLANT的配置

    1. CIF多个DC到EWM系统,创建SCU并配置成仓 2. tx:/sapapo/loc3 对多个DC生成分配模型 3. IMG:分配仓库编号 去掉缺省的授权处理方 4. 维护SCU hierarc ...

  6. 2014年最大福利:185个Google排名因素!免费电子书下载

    本博开张以来最大规模的干货放送!新手老手都有用! 不要再去追求PR了,不要再去发博客发论坛发外链了! 关注真正有用的Google排名因素! 整整185项,每一项都附带说明,必要的地方会给出一些附加的阅 ...

  7. [转帖]SAP一句话入门:Plant Maintenance

    SAP一句话入门:Plant Maintenance http://blog.vsharing.com/MilesForce/A618273.html PM就是Plant Maintenance(本文 ...

  8. 185. [USACO Oct08] 挖水井

    185. [USACO Oct08] 挖水井(点击转到COGS) 输入文件:water.in   输出文件:water.out   时间限制:1 s   内存限制:128 MB 描述 农夫约翰决定给他 ...

  9. centos 7 IP不能访问nginx Failed connect to 185.239.226.111:80; No route to host解决办法

    服务器环境 centos 7.4 问题描述 1.可以ping通IP ,用IP访问nginx 不能访问,在服务器上curl localhost  curl 185.239.226.111可以获得 [ro ...

随机推荐

  1. Receiver Operating Characteristics (ROC)

    The Receiver Operating Characteristics (ROC) of a classifier shows its performance as a trade off be ...

  2. python常用

    列出当前目录 import os: print os.getcwd() python load .mat variable a import scipy.io as sp tmp=sp.loadmat ...

  3. nyoj-0708-ones(dp)

    nyoj-0708-ones 题意:用1,+,*,(,). 这四个符号组成表达式表达数s(0 <= s <= 10000),且1最少时1的的个数 状态转移方程: dp[i] = min(d ...

  4. python全栈开发笔记---------基本数据类型

    基本数据类似包括: 字符串(str) 数字(int) 列表(list) 元祖(tuple) 字典(dict) 布尔值(bool) 字符串(引号): name = "我是某某某" n ...

  5. tomcat版本对应jee版本等信息

    可以参考官方: http://tomcat.apache.org/whichversion.html http://www.bubuko.com/infodetail-674892.html

  6. 多态概念,C++

    body, table{font-family: 微软雅黑; font-size: 10pt} table{border-collapse: collapse; border: solid gray; ...

  7. Mac生成rsa证书

    详细参考大神 https://blog.csdn.net/qq_30513483/article/details/51242338 RSA为一种加密算法,生成的文件格式有两种,一种是PEM格式,另一种 ...

  8. Cracking The Coding Interview 9.1

    //原文: // // You are given two sorted arrays, A and B, and A has a large enough buffer at the end to ...

  9. linux程序的常用保护机制

    操作系统提供了许多安全机制来尝试降低或阻止缓冲区溢出攻击带来的安全风险,包括DEP.ASLR等.在编写漏洞利用代码的时候,需要特别注意目标进程是否开启了DEP(Linux下对应NX).ASLR(Lin ...

  10. 小波学习之二(单层一维离散小波变换DWT的Mallat算法C++实现优化)--转载

    小波学习之二(单层一维离散小波变换DWT的Mallat算法C++实现优化)   在上回<小波学习之一>中,已经详细介绍了Mallat算法C++实现,效果还可以,但也存在一些问题,比如,代码 ...