• test


    公式测试
    (egin{array}{l} 考虑问题sumlimits ^{n}_{i=1}sumlimits ^{m}_{j=1} [gcd(i,j)=p] ( n,mleqslant 1e7)\ \ Leftrightarrow sumlimits _{p}sum olimits ^{lfloor frac{min( m,n)}{p} floor }_{d=1} mu ( g) lfloor frac{n}{pd} floor lfloor frac{m}{pd} floor \ \ \ Leftrightarrow sum ^{min( n,m)}_{i=1} lfloor frac{n}{i} floor lfloor frac{m}{i} floor sumlimits _{p|i} mu left(frac{i}{p} ight)\ \ \ 以上是推到的关键步骤,\ \ 以下是细节推导。\ \ \ ( 1) ightarrow ( 2) :firstly 对每个p分别计算其对答案贡献:\ \ ( 1) Leftrightarrow sumlimits _{p}sumlimits ^{lfloor frac{n}{p} floor }_{i=1}sumlimits ^{lfloor frac{m}{p} floor }_{j=1} [gcd(i,j)=1] \ \ \ secondly 为了得到( 2) ,较简单的方法是使用mobius inv的引理\ \ mu *I=e \ \ ( *是迪利克雷卷积 I( n) =n , e( n) =[ n=1] )\ \ 即sum _{d|n} mu ( d) =[ n=1]\ \ \ ( ( 6) 的证明:将n分解,n=p_{1}^{a_{1}} p_{2}^{a_{2}} ...p_{k}^{a_{k}} ,\ 所有mu 不为0,且有i个质因子的数的贡献可以表示为C( k,i) imes ( -1)^{i} ,\ 而forall n >1:sum ^{k}_{i=1} C( k,i) imes ( -1)^{i} =0 )\ \ herefore sum _{d|gcd( i,j)} mu ( d) =[ gcd( i,j) =1]\ \ herefore ( 4) Leftrightarrow sumlimits _{p}sumlimits ^{lfloor frac{n}{p} floor }_{i=1}sumlimits ^{lfloor frac{m}{p} floor }_{j=1}sum _{d|gcd( i,j)} mu ( d)\ \ Thirdly 我们比较( 2) 和( 7) 发现sumlimits ^{lfloor frac{n}{p} floor }_{i=1}sumlimits ^{lfloor frac{m}{p} floor }_{j=1}sum _{d|gcd( i,j)} 变成了sum olimits ^{lfloor frac{min( m,n)}{p} floor }_{d=1} lfloor frac{n}{pd} floor lfloor frac{m}{pd} floor \ \ 可以这么理解,我们枚举d,计算mu ( d) 的个数,\ \ left( d的取值范围是1sim lfloor frac{min( m,n)}{p} floor ight)\ \ ecause d|gcd( i,j) herefore i,j是d的倍数时才对结果有贡献,\ \ herefore mu ( d) 有lfloor frac{n}{pd} floor lfloor frac{m}{pd} floor 个。\ \ \ \ herefore sumlimits ^{n}_{i=1}sumlimits ^{m}_{j=1} [gcd(i,j)=p]Leftrightarrow sumlimits _{p}sumlimits ^{lfloor frac{n}{p} floor }_{i=1}sumlimits ^{lfloor frac{m}{p} floor }_{j=1}sum _{d|gcd( i,j)} mu ( d) Leftrightarrow sumlimits _{p}sum olimits ^{lfloor frac{min( m,n)}{p} floor }_{d=1} mu ( g) lfloor frac{n}{pd} floor lfloor frac{m}{pd} floor \ \ \ \ \ \ \ end{array})

    [a_i /neq i ]

    [frac{a}{b} +sqrt[3]{a+b} +int ^{a}_{b} dx+overbrace{a-b}^{n+1} +wideparen{ABC} +widehat{ABC} +Uparrow H_{2} 0Uparrow ]

    ideone 测试:

    公式测试:

    [sum_{i=1}^n frac{1}{i^2} quad and quad prod_{i=1}^n frac{1}{i^2} quad and quad igcup_{i=1}^{2} R ]

    代码段测试

    #include <bits/stdc++.h>
    using namespace std;
    
    bool isPalindrome(const string& s) {
        for(int i = 0; i < s.length(); ++i) {
            if (s[i] != s[s.length() - i - 1]) 
                return false;
        }
        return true;
    }
    
    bool solve1(string s) {
        string t = s;
        for(int i = 0; i < s.length(); ++i) {
            t = t.back() + t;
            t.pop_back();
            if (s != t && isPalindrome(t)) {
                return true;
            }
        }
        return false;
    }
    
    bool anyAnswer(const string& s) {
        int nt = 0;
        for(int i = 0; i < s.length(); ++i) {
            nt += s[i] != s[0];
        }
        return nt > 1;
    }
    
    int32_t main() {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr), cout.tie(nullptr);
    
        string s;
        cin >> s;
        if (anyAnswer(s)) {
            cout << (solve1(s) ? 1 : 2) << endl;
        } else {
            cout << "Impossible" << endl;
        }
    
        return 0;
    }
    
    
    成功的路并不拥挤,因为大部分人都在颓(笑)
  • 相关阅读:
    Exchange 2016与国内版O365混合部署(1):过程总览
    Office365与本地Exchange混合部署之邮件流介绍详情
    清理Exchange 2013和2016的Log文件(精华)
    Exchange2016日志路径
    C:/inetpub/logs/logfile/路径详解
    使用VMwareVCenterConverter迁移到虚拟机(p2v)
    WindowsServer安全基线
    利用WSUS部署更新程序
    Storefront与NetScaler的集成配置
    运维技巧(13):Exchange证书申请导入
  • 原文地址:https://www.cnblogs.com/SuuT/p/10432785.html
Copyright © 2020-2023  润新知