hdu5238

0: 1
1: 1
2: 3
3: 3
4: 5
5: 5
6: 7
7: 7
8: 9
9: 9
10: 11

11: 11

|

0: 0
1: 1
2: 0
3: 1
4: 0
5: 1
6: 0
7: 1
8: 0
9: 1
10: 0
11: 1
12: 0
13: 1
14: 0
15: 1
16: 0
17: 1
18: 0
19: 1

&

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MOD = 29393;
const int MAXN = 50005;
int mod[4] = {7,13,17,19};
int p[4][20][MOD];
int f[MAXN << 2][4][20];
void preprocess(){
    for(int i=0;i<4;i++){
        for(int j=0,m=mod[i];j<m;j++){
            p[i][j][0]=1;
            for(int k=1;k<MOD;k++){
                p[i][j][k]=p[i][j][k-1]*j%m;
            }
        }
    }
}
void push_up(int o){
    for(int i=0;i<4;i++){
        for(int j=0,m=mod[i];j<m;j++){
            f[o][i][j]=f[rs][i][f[ls]   ]
        }
    }
}
void build(int o,int l,int r){
    if(l==r){

    }
    int m=(l+r)>>1;
    build(  (o<<1) ,l,m );
    build(  (o<<1|1),m+1,r );
    push_up(o);
}
void solve(){
    char c;
    scanf("%d%d",&n,&m);
    build(1,1,n);
}
int main()
{
    int T;
    scanf("%d",&T);
    preprocess();
    for(int i=1;i<=T;i++){
        printf("Case #%d:\n",i);
        solve();
    }
    return 0;
}
/*

http://blog.csdn.net/u013368721/article/details/46232369
*/


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值