zoukankan      html  css  js  c++  java
  • [2020牛客寒假算法基础集训营2]G-判正误

    不得不说的是我觉得这道题十分的奇怪。

    取模数这么随便。我怀疑它没有很强的数据。

    先说说做法吧。就是简单的快速幂取模即可。(但是这个取模也太玄学了吧。出题人自己都说多尝试几次,我吐了

    #include <bits/stdc++.h>
    #define speed std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
    using namespace std;
    typedef long long ll;
    
    const ll maxn = 200005;
    const ll mod = 1e9+7;
    ll a,b,c,d,e,f,g;
    ll ans=0;
    ll qpow(ll a, ll b){
        ll ret = 1;
        while(b){
            if(b & 1) ret = (ret * a) % mod;
            a = (a * a) % mod;
            b >>= 1;
        }
        return ret;
    }
    
    int main()
    {
        speed;
        ll T;
        cin>>T;
        while(T--){
            cin>>a>>b>>c>>d>>e>>f>>g;
            ll tmp=(qpow(a,d)+qpow(b,e)+qpow(c,f));
            if(tmp==g){
                cout<<"Yes
    ";
            }
            else{
                cout<<"No
    ";
            }
        }
    }
  • 相关阅读:
    too many open files linux服务器 golang java
    fasthttp 文档手册
    syncer.go
    grpc.go
    stm.go
    session.go
    mutex.go
    [HTML5]label标签使用以及建议
    禁止使用finalize方法
    [支付宝]手机网站支付快速接入
  • 原文地址:https://www.cnblogs.com/Vikyanite/p/12288340.html
Copyright © 2011-2022 走看看