#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. JAVA的SPI简单应用

    最近在研究dubbo时,发现了JAVA的SPI特性.SPI的全名为Service Provider Interface,是JDK内置的一种服务发现机制. 具体实现: 1.定义一个接口 public i ...

  2. js之单例

    所谓单例,指的是只有一个实例的对象. js通过对象字面量的方式来创建单例对象. var sig = { name:value, method:function(){ } }

  3. laravel使用使用 Php Artisan Tinker 实现模型的增删改查

    tinker命令: php artisan tinker 查阅数据库数据: App\User::count(); App\User::where('username', 'samuel')->f ...

  4. learning ddr mode reigster set command cycle time tMRD and tMOD

    tMRD: tMOD:

  5. jquery插件artTxtCount输入字数限制,并提示剩余字数

    工作中用到,需要批量处理下 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http ...

  6. mybatis实战教程

    参考:http://blog.csdn.net/techbirds_bao/article/details/9233599/

  7. VCL界面控件DevExpress VCL发布v18.2.2|附下载

    DevExpress VCL Controls是 Devexpress公司旗下最老牌的用户界面套包.所包含的控件有:数据录入,图表,数据分析,导航,布局,网格,日程管理,样式,打印和工作流等,让您快速 ...

  8. ubuntu 安装pptp

    1.安装PPTP服务器 更新软件 apt-get update 安装pptpdapt-get install pptpd 2.配置PPTP服务器 用 vi 编辑/etc/pptpd.conf查找如下内 ...

  9. 12.Python爬虫利器三之Xpath语法与lxml库的用法

    LXML解析库使用的是Xpath语法: XPath 是一门语言 XPath可以在XML文档中查找信息 XPath支持HTML XPath通过元素和属性进行导航 XPath可以用来提取信息 XPath比 ...

  10. L259 合同

    We are satisfied with the terms of this contract for the most part, but we feel that your terms of p ...