当前位置:网站首页>舔狗舔到最后一无所有(状态机)
舔狗舔到最后一无所有(状态机)
2022-07-04 12:44:00 【.染】
题目描述
作为队伍的核心,forever97很受另外两个队友的尊敬。
Trote_w每天都要请forever97吃外卖,但很不幸的是宇宙中心forever97所在的学校周围只有3家forever97爱吃的外卖。
如果Trote_w给forever97买了别家的外卖,forever97就会大喊“我不吃我不吃”。
但是forever97又不喜欢连续三天吃一种外卖。
如果Trote_w哪天忘了这件事并且三天给他买了同一家外卖,那么forever97就会把Trote_w的头摁进手机屏幕里。
作为Trote_w的好朋友,你能告诉他连续请forever97吃n天饭,有多少不同的购买方法吗?
输入描述:
多组样例
第一行一个整数T(1<=T<=20)代表测试样例数
接下来t行每行一个整数n,代表Trote_w要请forever97吃n天饭(1<=n<=100000)
输出描述:
输出T个整数代表方案数,由于答案太大,你只需要输出mod 1e9+7 后的答案即可。
示例1
输入
2
3
500
输出
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;
}
}
边栏推荐
- XML入门三
- Web knowledge supplement
- 上汽大通MAXUS正式发布全新品牌“MIFA”,旗舰产品MIFA 9正式亮相!
- C#基础深入学习二
- Xue Jing, director of insight technology solutions: Federal learning helps secure the flow of data elements
- 7 月数据库排行榜:MongoDB 和 Oracle 分数下降最多
- SQL statement syntax error in test SQL statement deletion in eclipse linked database
- 爬虫练习题(一)
- Solution: how to delete the information of Jack in two tables with delete in one statement in Oracle
- Excuse me, have you encountered this situation? CDC 1.4 cannot use timestamp when connecting to MySQL 5.7
猜你喜欢

诸神黄昏时代的对比学习

Runc hang causes the kubernetes node notready

上汽大通MAXUS正式发布全新品牌“MIFA”,旗舰产品MIFA 9正式亮相!

n++也不靠谱

AI painting minimalist tutorial

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

Oracle 被 Ventana Research 评为数字创新奖总冠军

C#/VB. Net to add text / image watermarks to PDF documents

聊聊支付流程的设计与实现逻辑

After installing vscode, the program runs (an include error is detected, please update the includepath, which has been solved for this translation unit (waveform curve is disabled) and (the source fil
随机推荐
Samsung's mass production of 3nm products has attracted the attention of Taiwan media: whether it can improve the input-output rate in the short term is the key to compete with TSMC
求解:在oracle中如何用一条语句用delete删除两个表中jack的信息
XML入门一
CANN算子:利用迭代器高效实现Tensor数据切割分块处理
FS4056 800mA充电ic 国产快充电源ic
MySQL three-level distribution agent relationship storage
6 分钟看完 BGP 协议。
CVPR 2022 | TransFusion:用Transformer进行3D目标检测的激光雷达-相机融合
After the game starts, you will be prompted to install HMS core. Click Cancel, and you will not be prompted to install HMS core again (initialization failure returns 907135003)
The only core indicator of high-quality software architecture
Introduction to XML III
remount of the / superblock failed: Permission denied
用fail2ban阻止密码尝试攻
C foundation in-depth learning II
Xue Jing, director of insight technology solutions: Federal learning helps secure the flow of data elements
iptables基础及Samba配置举例
C foundation in-depth study I
「小技巧」给Seurat对象瘦瘦身
Flet教程之 03 FilledButton基础入门(教程含源码)(教程含源码)
再说rsync+inotify实现数据的实时备份