一段长度为n的序列,你有红黄蓝绿四种颜色的砖块,一块砖长度为1,问你铺砖的方案数,其中红黄颜色之和必须为偶数。

#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std; #define fi first
#define se second typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll; const int maxn = 1000 + 5;
const int maxm = 100 + 5;
const int inf = 0x3f3f3f3f;
const LL mod = 10000 + 7;//19260817
const double pi = acos(-1.0); LL n, res; LL fpow(LL a, LL n){
LL ans = 1;
while(n){
if(n & 1) ans = ans * a % mod;
a = a * a % mod;
n >>= 1;
}
return ans;
} int main(){
int T;
scanf("%d", &T);
while(T--){
scanf("%lld", &n);
printf("%lld\n", (1LL * fpow(4, n - 1) % mod + fpow(2, n - 1) % mod) % mod);
}
return 0;
}
原文链接:https://blog.csdn.net/qq_43464645/article/details/95488472

  

最新文章

  1. C(C++)输入输出格式
  2. BizTalk开发系列(十五) Schema设计之Qualified 与Unqualified
  3. Visual Studio发布Web项目报错:Unable to add &#39;xxx&#39; to the Web site. Unable to add file &#39;xxx&#39;. The specified file could not be encrypted.
  4. shell将输入的参数逆序
  5. 重点关注之Filter的使用(性能计数和错误处理)
  6. HDU 1532 Drainage Ditches EK算法 flod算法
  7. 220 DIV2 B. Inna and Nine
  8. Ubuntu 下安装VNC server
  9. 【C语言】-数据输入-scanf( )和getchar( )
  10. ubuntu下编译安装PHP
  11. powerdesigner设置唯一键,但不是主键的方式
  12. 基于visual Studio2013解决C语言竞赛题之1066进制转化
  13. Oracle 多行转多列
  14. wpf资源嵌套,一个资源引用另外一个资源,被引用的资源应该声明在前面
  15. CodeForces 609A USB Flash Drives
  16. C语言学习第三章
  17. 2.3.2 InnoDB内存
  18. 普通用户添加sudo权限
  19. linux 添加ssh和开启ssh服务apt管理的ubuntu
  20. 计算机系统的通信PPT版本

热门文章

  1. 自签名ssl
  2. 06-char,varchar和nvarchar三者的区别
  3. js特效 15个小demo
  4. 【Layui】Layui模板引擎生成下拉框不显示
  5. jquery animate()方法 语法
  6. python socket.io 坑。
  7. ValseWebninar 报告汇总
  8. vue子路由设置、全局组件、局部组件的原生写法
  9. 通过nginx转发,用外网连接阿里云的redis,报Unexpected end of stream的解决办法
  10. Codeforces 514 D R2D2 and Droid Army(Trie树)