判正误
判正误
http://www.nowcoder.com/questionTerminal/327a56cada244fc79c7d61936624989c
判正误
https://ac.nowcoder.com/acm/contest/3003/G
考察快速幂求余
g<=1e9,可考虑mod=1e9+7
在左边三项求幂运算中,对其进行快速幂同时mod即可
#pragma warning (disable :4996)
#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 10;
ll mod = 1e9 + 7;
ll a, b, c, d, e, f, g;
ll quick(ll x, ll y) {
ll res = 1;
while (y) {
if (y & 1) res = (res*x)%mod;
x =(x* x)%mod;
y = y >>= 1;
}
return res;
}
int main()
{
int t;
scanf("%d", &t);
while (t--) {
scanf("%lld %lld %lld %lld %lld %lld %lld", &a, &b, &c, &d, &e, &f, &g);
ll x, y, z;
x = quick(a, d)%mod;
y = quick(b, e)%mod;
z = quick(c, f)%mod;
g = g % mod;
if (x + y + z == g)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
}
