1 solutions

  • 0
    @ 2024-6-15 15:44:58
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long LL;
    const int P=200907;
    LL qmi(int a,int k)
    {
        LL res=1%P;
        while(k) //快速幂模板
        {
            if(k&1) res=res*a%P;
            a=(LL)a*a%P;
            k=k>>1;
        }
        return res;
    } 
    int main()
    {
        int t;
        cin>>t;
        while(t--)
        {
            LL a,b,c,k;
            cin>>a>>b>>c>>k;
            if(a+c==2*b) //等差数列
            {
                cout<<(a+(b-a)*(k-1))%P<<endl;  
            } 
            else //等比数列
            {
                cout<<a*qmi(b/a,k-1)%P<<endl;
            }
        }
        return 0;
    }
    
    • 1

    Information

    ID
    187
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    # Submissions
    13
    Accepted
    5
    Uploaded By