F-Finding the Order
题意
大水题,A和B在一条线上,C和D在一条线上,给定AC,AD,BC,BD的距离,判断是AB||CD还是AB||DC(C和D的位置不同,“CD"和“DC”不一样)
思路
根据三角形两边之和大于第三边,中间交叉两边之和必定大于两边的两条线之和,判断AC+BD和AD+BC的大小即可
代码
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int a,b,c,d;
cin>>a>>b>>c>>d;
if(a+d>b+c)puts("AB//CD");
else puts("AB//DC");
}
return 0;
}
B-Basic Gcd Problem
题意
给你一个n和c,计算
思路
我们发现每一次递归都会乘一次c,而每一次递归的条件便是x是否为质数,所以可以得出最后的答案为cn的质因子个数
代码
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6+5;
const int mod = 1e9 + 7;
ll qmi(int a,int b){
ll res=1%mod;while(b){
if(b&1)res=res*a%mod;b>>=1;a=(ll)a*a%mod;}