POJ3734 Block母函数入门
2024-10-07 01:24:57
一段长度为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
最新文章
- C(C++)输入输出格式
- BizTalk开发系列(十五) Schema设计之Qualified 与Unqualified
- 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.
- shell将输入的参数逆序
- 重点关注之Filter的使用(性能计数和错误处理)
- HDU 1532 Drainage Ditches EK算法 flod算法
- 220 DIV2 B. Inna and Nine
- Ubuntu 下安装VNC server
- 【C语言】-数据输入-scanf( )和getchar( )
- ubuntu下编译安装PHP
- powerdesigner设置唯一键,但不是主键的方式
- 基于visual Studio2013解决C语言竞赛题之1066进制转化
- Oracle 多行转多列
- wpf资源嵌套,一个资源引用另外一个资源,被引用的资源应该声明在前面
- CodeForces 609A USB Flash Drives
- C语言学习第三章
- 2.3.2 InnoDB内存
- 普通用户添加sudo权限
- linux 添加ssh和开启ssh服务apt管理的ubuntu
- 计算机系统的通信PPT版本