zoukankan      html  css  js  c++  java
  • 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
    

      

  • 相关阅读:
    [JLOI2015] 管道连接
    【知识点】斯坦纳树
    [ZJOI2010] 网络扩容
    【知识点】网络流常见模型
    [NOI2009] 植物大战僵尸
    [NOI2007] 货币兑换
    【知识点】分治相关算法
    [NOI2005] 月下柠檬树
    [HNOI2012] 射箭
    [SDOI2014] 向量集
  • 原文地址:https://www.cnblogs.com/cutemush/p/12066680.html
Copyright © 2011-2022 走看看