#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. API设计和命名

    1.前言 对于前端开发而言,肯定会和API打交道,大家也都会想过怎么设计自己的API.优秀的 API 之于代码,就如良好内涵对于每个人.好的 API 不但利于使用者理解,开发时也会事半功倍,后期维护更 ...

  2. python settings :RROR 1130: Host 'XXXXXX' is not allowed to connect to this MySQL server

    pymysql.err.InternalError: (1130, u"Host '127.0.0.1' is not allowed to connect to this MySQL se ...

  3. shell test判断命令

    判断命令test 使用test命令可以对文件,字符串等进行测试,一般配合控制语句使用,如while,if,case "字符串测试"   test str1==str2 测试字符串是 ...

  4. WPF 创建自定义控件及自定义事件

    1 创建自定义控件及自定义事件 /// <summary> /// 演示用的自定义控件 /// </summary> public class ExtButton : Butt ...

  5. hMailServer SSL 配置

    1.先安装 openssl , 调用如下命令,生成证书: openssl genrsa -des3 - openssl req -new -key alics.key -out alics.req o ...

  6. confirm消息对话框

    function rec(){ var mymessage= confirm("你是女孩?") ; if(mymessage==true) { document.write(&qu ...

  7. DevExpress WinForms v18.2新版亮点(八)

    买 DevExpress Universal Subscription  免费赠 万元汉化资源包1套! 限量15套!先到先得,送完即止!立即抢购>> 行业领先的.NET界面控件2018年第 ...

  8. CSS颜色

    CSS 颜色 可以用以下方法来规定 CSS 中的颜色: ·        十六进制色 十六进制值使用三个双位数来编写,并以 # 符号开头. ·        RGB 颜色 o   所有浏览器都支持 R ...

  9. UBUNTU 测试跑分

    time echo "scale=5000; 4*a(1)" | bc -l -q3.14159265358979323846264338327950288419716939937 ...

  10. 牛客多校第四场 G Maximum Mode

    链接:https://www.nowcoder.com/acm/contest/142/G来源:牛客网 The mode of an integer sequence is the value tha ...