当前位置:网站首页>Lick the dog until the last one has nothing (state machine)
Lick the dog until the last one has nothing (state machine)
2022-07-04 13:51:00 【. dye】
Title Description
As the core of the team ,forever97 He is respected by the other two teammates .
Trote_w Please... Every day forever97 Take out , But unfortunately, the center of the universe forever97 There are only 3 home forever97 Favorite takeout .
If Trote_w to forever97 Bought takeout from another family ,forever97 Will shout “ I don't eat I don't eat ”.
however forever97 I don't like to eat a takeout for three days in a row .
If Trote_w One day I forgot about it and bought him the same takeout for three days , that forever97 It will Trote_w Press your head into the screen of your mobile phone .
As Trote_w Good friends , You can tell him to keep asking forever97 eat n Tianfan , How many different ways to buy ?
Input description :
Multiple sets of samples
The first line is an integer T(1<=T<=20) Represents the number of test samples
Next t Each row is an integer n, representative Trote_w Please forever97 eat n Tianfan (1<=n<=100000)
Output description :
Output T An integer represents the number of schemes , Because the answer is too big , You just need to output mod 1e9+7 The answer after .
Example 1
Input
2
3
500
Output
24
544984352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M=1e9+7;
ll dp[2][100000+10];
int main()
{ ll n,t; cin>>t;
dp[0][1]=3; dp[1][0]=0;
for(int i=2;i<=100000+10;i++)
{
dp[0][i]=(dp[1][i-1]*2+dp[0][i-1]*2)%M;
dp[1][i]=dp[0][i-1]%M;
}
while(t--)
{ cin>>n;
cout<<(dp[0][n]%M+dp[1][n]%M)%M<<endl;
}
}
边栏推荐
- Commvault 和 Oracle 合作,在 Oracle 云上提供 Metallic数据管理即服务
- 提高MySQL深分页查询效率的三种方案
- Optional values and functions of the itemized contenttype parameter in the request header
- [FAQ] summary of common causes and solutions of Huawei account service error 907135701
- OpenHarmony应用开发之如何创建DAYU200预览器
- 高效!用虚拟用户搭建FTP工作环境
- Dgraph: large scale dynamic graph dataset
- Solution: how to delete the information of Jack in two tables with delete in one statement in Oracle
- 近日小结(非技术文)
- Read the BGP agreement in 6 minutes.
猜你喜欢

When MDK uses precompiler in header file, ifdef is invalid

30:第三章:开发通行证服务:13:开发【更改/完善用户信息,接口】;(使用***BO类承接参数,并使用了参数校验)

Reptile exercises (I)

面试官:Redis中哈希数据类型的内部实现方式是什么?

一次 Keepalived 高可用的事故,让我重学了一遍它

Golang sets the small details of goproxy proxy proxy, which is applicable to go module download timeout and Alibaba cloud image go module download timeout

Comparative study of the gods in the twilight Era

Xue Jing, director of insight technology solutions: Federal learning helps secure the flow of data elements

N++ is not reliable

室外LED屏幕防水吗?
随机推荐
Practice: fabric user certificate revocation operation process
Reading cognitive Awakening
Redis —— How To Install Redis And Configuration(如何快速在 Ubuntu18.04 与 CentOS7.6 Linux 系统上安装 Redis)
C語言宿舍管理查詢軟件
A data person understands and deepens the domain model
CA: efficient coordinate attention mechanism for mobile terminals | CVPR 2021
Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation
程序员转方向
Distributed base theory
使用宝塔部署halo博客
Service Mesh的基本模式
C语言小型商品管理系统
模块化笔记软件综合评测:Craft、Notion、FlowUs
数据库公共字段自动填充
舔狗舔到最后一无所有(状态机)
Apache服务器访问日志access.log设置
提高MySQL深分页查询效率的三种方案
FS4056 800mA充电ic 国产快充电源ic
C语言个人通讯录管理系统
Runc hang causes the kubernetes node notready