zoukankan      html  css  js  c++  java
  • 函数 [计数]

    感谢 JR 赞助

    在这里插入图片描述


    SOLUTIONmathbb{SOLUTION}

    F(x)=yF(x) = y, 沿着 F[F(x)]=xF[F(x)] =-x 这个规则推

    F(x)=y                             XF(x)=y mathcal{X}
             
    F(y)=F[F(x)]=xF(y) = F[F(x)] = -x
                       
    F(x)=F[F(y)]=yF(-x)=F[F(y)] = -y
                       
    F(y)=F[F(x)]=xF(-y) = F[F(-x)] = x
                       
    F(x)=F[F(y)]=y        YF(x)=F[F(-y)]=y mathcal{Y}

    会发现 Xmathcal{X}式 又等价于 Ymathcal{Y}式,
    得出结论: 对两个正整数 x,yx,y,F(x)=± yF(x)=± y, 只会影响到F(x),F(y),F(x),F(y)F(x), F(y), F(-x), F(-y)四个函数的值.

    不考虑负数的存在, 原问题转换为
    1,2,3,..,R1, 2, 3, .., R 序列中两两配对的方案数,
    F(x)=± yF(x) = ± y 是两种不同的方案, 即一次配对有两种不同的选择,
    Ans=2R/2(N1)(N3)...1∴ Ans = 2^{R/2}*(N-1)*(N-3)...*1


    CODEmathbb{CODE}

    #include<bits/stdc++.h>
    #define reg register
    
    const int maxn = 10000007;
    
    int L;
    int R;
    int Ans;
    
    const int mod = 666623333;
    
    int KSM(int a, int b){
            int s = 1;
            while(b){
                    if(b & 1) s = 1ll*s*a % mod;
                    a = 1ll*a*a % mod;
                    b >>= 1;
            }
            return s;
    }
    
    int main(){
            scanf("%d%d", &L, &R); 
            if(L != -R) printf("0
    "); 
            else if((L&1) || (R&1)) printf("0
    "); 
            else{ 
                    Ans = KSM(2, R/2); 
                    for(reg int i = 3; i <= R; i += 2){ 
                            Ans = 1ll*Ans*i % mod; 
                    } 
                    printf("%d
    ", Ans);
            }
            return 0;
    }
    
  • 相关阅读:
    How can i install ctags in centos 6.4
    [转载] Ubuntu Vim powerline 插件
    Vim 相关网页
    [转载] vim技巧:设置空格和Tab字符可见
    Don't trust cplusplus.com, it's crap. If any, go to cppreference.com.
    Vim yank only 50 lines
    按进程名终止进程
    Shell 脚本 Tips
    Bash 脚本 逐行处理文本文件的内容
    生成并配置https本地证书
  • 原文地址:https://www.cnblogs.com/zbr162/p/11822626.html
Copyright © 2011-2022 走看看