今天不知道是网卡还是TC的问题一直爆炸,这题还是在vj上交的
插件再次神秘失踪 自己装了插件貌似哪里没弄好。。反正很奇怪
辣鸡TC毁我青春 打CF去了
不太懂为什么这种题也是1000
// BEGIN CUT HERE
// END CUT HERE
#line 5 "EllysCoprimesDiv2.cpp"
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
return b==0?a:gcd(b,a%b);
}
int pd(int x,int y){
for(int i=x;i<y;i++)
if (gcd(x,i)==1&&gcd(y,i)==1) return 1;
return 0;
}
class EllysCoprimesDiv2 {
public:
int getCount(vector <int> a) {
sort(a.begin(),a.end());
int ans=0;
for(int i=1;i<a.size();i++)
if (gcd(a[i-1],a[i])>1){
ans++;
if (!pd(a[i-1],a[i])) ans++;
}
return ans;
}
};