2020 7.12 -- 7.13 两场牛客多校 + 两场 unrated的cf的补题
程序员文章站
2022-07-02 23:10:45
自闭ing之后的多校就不打了…太难了吧…...
自闭ing之后的多校就不打了…太难了吧…
7.12多校
2020牛客暑期多校训练营(第一场) F Infinite String Comparision
少数几个会写的题 (唯二
开始想的是要lcm(n,m)然后再比较,但是好像只需要2倍的最大长度就行了
2020牛客暑期多校训练营(第一场)J Easy Integration
积分题按照找规律写qaq,赛后学长发了扩展的结论:
自闭啊没啥要补的了qaq啥也不会了
还有一件事
map存double会有精度误差
可以用数组存数据,然后sort,去重计算exp内的个数
例如 第二场的B
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<unordered_map>
#define endl '\n'
#define all(s) s.begin(),s.end()
#define lowbit(x) (x&-x)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define pb push_back
#define pi acos(-1.0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<long double,long double> pii;
const int mod=1e9+7;
const double eps=1e-8;
const int inf=0x3f3f3f3f;
const int N=2e5+10;
double a[N], b[N] , c[N];
struct Point{
double x,y;
Point(double x,double y){
this->x=x;
this->y=y;
}
Point(){
x=y=0;
}
};
Point p[5000];
//过三点求圆心坐标
Point waixin(Point a,Point b,Point c)
{
double a1 = b.x - a.x, b1 = b.y - a.y, c1 = (a1*a1 + b1*b1)/2;
double a2 = c.x - a.x, b2 = c.y - a.y, c2 = (a2*a2 + b2*b2)/2;
double d = a1*b2 - a2*b1;
return Point(a.x + (c1*b2 - c2*b1)/d, a.y + (a1*c2 -a2*c1)/d);
}
int main()
{
int n,m,q,k;
cin>>n;
for(int i = 1;i<=n;i++){
cin >>p[i].x>>p[i].y;
}
int ans = 1;
vector<pii> v;
Point z(0,0);
for (int i = 1; i <= n; i ++){
for (int j = i + 1; j <= n; j ++){
if(fabs(p[i].x*p[j].y-p[i].y*p[j].x)>eps){
Point temp=waixin(p[i],p[j],z);
// cout<<p[i].x<<" "<<p[i].y<<" "<<p[j].x<<" "<<p[j].y<<" "<<temp.x<<" "<<temp.y<<endl;
v.pb(make_pair(temp.x,temp.y));
}
}
}
if(v.size()==0){
cout << 1;
return 0;
}
sort(all(v));
int now = 1;
for(int i = 1; i < int(v.size()); i ++){
if(abs(v[i].fi - v[i - 1].fi) < eps && abs(v[i].se - v[i - 1].se) < eps){
now ++;
ans = max( ans , now);
}else now = 1;
}
for(int i = 1;i <= n ;i ++){
if(i*(i-1)==2*ans){
cout <<i ;
break;
}
}
}
本文地址:https://blog.csdn.net/lingdie_yy/article/details/107320558