[算法]欧几里德算法 [题解]紫书原题 #include<cstdio> #include<algorithm> using namespace std; ; int T,t,n,a[maxn]; int gcd(int a,int b) {?a:gcd(b,a%b);} int main() { scanf("%d",&T); ;i<=T;i++) { scanf(],&t); ;i<n;i++)scanf("%d&quo…
加括号再去括号就是除变加,显然尽可能多的除变加是最优的,然后发现唯一不能变成乘数的是第二个数,所以把其他数乘起来mod第二个数,如果是0就是YES,否则说明最后不能除尽,就是NO #include<iostream> #include<cstdio> using namespace std; int T,n,nw,mod; int read() { int r=0,f=1; char p=getchar(); while(p>'9'||p<'0') { if(p=='-…
链接: https://vjudge.net/problem/LightOJ-1214 题意: Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a = b * c. 思路:…