zoukankan      html  css  js  c++  java
  • Codeforces 1316C Primitive Primes

    题目链接

    mathforces round Gauss's lemma

    说人话就是,高斯引理的多项式目,就是两个本原多项式(primitive polynomial)的乘积还是本原多项式,而本原多项式就是(f(x) = a_0 + a_1x + dots + a_{n-1}x^{n-1}), (gcd(a_0, a_1, dots, a_{n-1}) = 1), 知道这个定理, 直接对两个本原多项式找p的不可约元, 相乘也是p的不可约元, 我对着FFT调到天荒地老

    #include<bits/stdc++.h>
    using namespace std;
    #define ms(x,y) memset(x, y, sizeof(x))
    #define lowbit(x) ((x)&(-x))
    typedef long long LL;
    typedef pair<int,int> pii;
    
    
    
    void run_case() {
        int n, m, p;
        cin >> n >> m >> p;
        vector<int> a(n), b(m);
        for(auto &x: a) cin >> x;
        for(auto &x: b) cin >> x;
        int ans1, ans2;
        for(int i = 0; i < n; ++i)
            if(a[i] % p) ans1 = i;
        for(int i = 0; i < m; ++i)
            if(b[i] % p) ans2 = i;
        cout << ans1+ans2;    
    }
    
    int main() {
        ios::sync_with_stdio(false), cin.tie(0);
        cout.flags(ios::fixed);cout.precision(2);
        //int t; cin >> t;
        //while(t--)
        run_case();
        cout.flush();
        return 0;
    }
    
  • 相关阅读:
    数学考试
    奇♂妙拆分
    11.25
    11.21
    11.20
    11.19
    11.18
    11.15
    11.14作业
    11.14
  • 原文地址:https://www.cnblogs.com/GRedComeT/p/12444447.html
Copyright © 2011-2022 走看看