• POJ3734 Block母函数入门


    一段长度为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
    ", (1LL * fpow(4, n - 1) % mod + fpow(2, n - 1) % mod) % mod);
    	}
        return 0;
    }
    原文链接:https://blog.csdn.net/qq_43464645/article/details/95488472
    

      

  • 相关阅读:
    OpenStack源码系列---neutron-server
    理解全虚拟、半虚拟以及硬件辅助的虚拟化
    QEMU+GDB调试方法
    SQL Server故障转移集群
    OpenStack源码系列---nova-conductor
    mysql 安装和基本使用
    数据库原理
    linux 计划任务
    linux 进程管理和内存分配

  • 原文地址:https://www.cnblogs.com/cutemush/p/12066680.html
Copyright © 2020-2023  润新知