比赛情况
过程:开场cqf签到D我签到C。然后wmd开I(并且成功成为全场除北大外第二个过掉I的 )。
然后开K,一起想了半小时左右cqf想到了正解,直接上。 然后…开始罚坐到比赛结束。本人甲级战犯,F推错公式坑惨队友。
TC Draw Grids
题意: 给定一个n*m的点阵,每次选两个相邻点连线
两个人轮流操作,不能连出封闭图形,不能操作者输。
idea: 不能连出封闭图形就是不能形成环,也就是图始终是一片森林
终态一定是一棵生成树,因此根据点数奇偶性即可判断
#include<iostream>
#include<cstdio>
#include<cstring>
#define LL long long
using namespace std;
int n,m;
int main()
{
cin>>n>>m;
if( n%2==0 || m%2==0 )
{
printf("YES");
}
else printf("NO");
return 0;
}
TF Girlfriend
题意:
idea:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
using namespace std;
const double eps = 1e-4;
const double PI = acos(-1);
int T;
int main() {
//freopen("test.in", "r", stdin);
cin >> T;
while(T--) {
double a[3], b[3], c[3], d[3], k1, k2;
cin >> a[0] >> a[1] >> a[2];
cin >> b[0] >> b[1] >> b[2];
cin >> c[0] >> c[1] >> c[2];
cin >> d[0] >> d[1] >> d[2];
cin >> k1 >> k2;
double x1 = b[0] - (b[0] - a[0]) / (k1 + 1);
double y1 = b[1] - (b[1] - a[1]) / (k1 + 1);
double z1 = b[2] - (b[2] - a[2]) / (k1 + 1);
double x2 = b[0] + ( (b[0] - a[0]) / ( k1-1 ) );
double y2 = b[1] + ( (b[1] - a[1]) / ( k1-1 ) );
double z2 = b[2] + ( (b[2] - a[2]) / ( k1-1 ) );
double r1 = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2)) * 0.5;
double c1 = (x1 + x2) * 0.5;
double c2 = (y1 + y2) * 0.5;
double c3 = (z1 + z2) * 0.5;
x1 = d[0] - (d[0] - c[0]) / (k2 + 1);
y1 = d[1] - (d[1] - c[1]) / (k2 + 1);
z1 = d[2] - (d[2] - c[2]) / (k2 + 1);
x2 = d[0] + ( (d[0] - c[0]) / ( k2-1 ) );
y2 = d[1] + ( (d[1] - c[1]) / ( k2-1 ) );
z2 = d[2] + ( (d[2] - c[2]) / ( k2-1 ) );
double r2 = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2)) * 0.5;
double t1 = (x1 + x2) * 0.5;
double t2 = (y1 + y2) * 0.5;
double t3 = (z1 + z2) * 0.5;
double dis = sqrt((c1 - t1) * (c1 - t1) + (c2 - t2) * (c2 - t2) + (c3 - t3) * (c3 - t3));
double alpha1 = (r1 * r1 + dis * dis - r2 * r2) / (2 * dis * r1);
double h1 = r1 - r1 * alpha1;
double alpha2 = (r2 * r2 + dis * dis - r1 * r1) / (2 * dis * r2);
double h2 = r2 - r2 * alpha2;
if(r2 > r1) swap(r1, r2), swap(h1, h2);
double ans;
if( dis - r1 - r2 >= eps ) ans = 0;
else if(dis + r2 - r1 <= eps ) ans = 4.0 / 3.0 * PI * r2 * r2 * r2;
// else if(dis - r1 <= eps && dis + r2 - r1 >= eps) ans = 4.0 / 3.0 * PI * r2 * r2 * r2- PI * h2 * h2 * (r2 - h2 / 3) + PI * h1 * h1 * (r1 - h1 / 3);
else ans = PI * h1 * h1 * (r1 - h1 / 3) + PI * h2 * h2 * (r2 - h2 / 3);
printf("%.5lf\n", ans);
}
return 0;
}