Experimental Educational Round: VolBIT Formulas Blitz(数学、组合数学)

A Again Twenty Five!

:5n2,2n1018
puts("25");

B Moore’s Law

:n1.000000011t
:ans=npow(1.000000011,t)

C Lucky Numbers

:n,78
:ans=21+22++2n=2n+12

D Hexagons!

:n
:6,
ans=1+6n+n(n1)/26

E A rectangle

:,(x1x2,y1y2),(x1,y1),(x2x1)%2==0

:,n,n1
n,
ans=((y2y1)/2+1)(x2x1+1)(x2x1)/2;

F Selection of Personnel

:n567
:ans=C5n+C6n+C7n

G Challenge Pennants

:n,A5,B3,A,B,
:,n,
ans=Cn15+n1Cn13+n1

H Benches

:5n×n,
:xy,C5n,
ans=(C5n)2P55

I Parking Lot

:2n2,4,n,
:,dp,f[i][0/1]:=i,n,
f[i][0]=1,f[i][0]=0,,4,3

f[0][0] = 1;
for(int i = 1; i <= 2 * n - 2; ++i) {
    if(i >= n) f[i][1] += (i == n ? 4 : 3) * f[i - n][0];
    for(int j = 1; j <= i && j <= n; ++j) {
        f[i][0] += (i == j ? 4 : 3) * f[i - j][0];
        f[i][1] += (i == j ? 4 : 3) * f[i - j][1];
    }
}

ans=f[2n2][1]

J Divisibility

:[1,n]numbers[2,10]
:ans=n/lcm10i=2i=n/2520

K Indivisibility

:[1,n]numbers[2,10]
:ans=nE[1,n]numbers[2,10]
,lcm

vector<int> v;
for(int i = 2; i <= 10; ++i) v.push_back(i);
long long ans = n;
for(int i = 1; i < 1 << 9; ++i) {
    int cnt = 0, lcm = 1;
    for(int j = 0; j < 9; ++j)
        if(i >> j & 1) lcm = lcm / __gcd(lcm, v[j]) * v[j], ++cnt;
    if(cnt & 1) ans -= n / lcm;
    else ans += n / lcm;
}
printf("%I64d\n", ans);

L Cracking the Code

:,NNc,N5c5

char s[10], t[10];
int d[] = {0, 1, 3, 5, 4, 2};
for(int i = 1; i <= 5; ++i) t[i] = s[d[i]];
long long x = atoi(t + 1), ans = 1;
for(int i = 1; i <= 5; ++i)
    ans = ans * x % 100000;
printf("%05I64d\n", ans);

M Turn

:(),+,,0
:03,

int dif = INF, ans = -1;
for(int i = 0; i < 4; ++i) {
    int y = ((x - 90 * i) % 360 + 360) % 360;
    y = min(y, 360 - y);
    if(y < dif) ans = i, dif = y;
}
printf("%d\n", ans);

N Forecast

:2,

double delta = sqrt(b * b - 4 * a * c);
double r1 = (-b - delta) / 2 / a, r2 = (-b + delta) / 2 / a;
if(r1 < r2) swap(r1, r2);
printf("%.12f\n%.12f\n", r1, r2);

O Arrow

:西,,

double px, py, vx, vy, a, b, c, d;

struct Point {
    double x, y;
    void read() {scanf("%lf%lf", &x, &y);}
    void print() {printf("%.12f %.12f\n", x, y);}

    Point operator+(const Point& p) {
        return {x + p.x, y + p.y};
    }
    Point operator-(const Point& p) {
        return {x - p.x, y - p.y};
    }
    Point operator*(const double& c) {
        return {c * x, c * y};
    }
    double length() {return hypot(x, y);}
    void normalize() {
        double len = length();
        x /= len;
        y /= len;
    }
    Point rotate() { //clock-wise;
        return {y, -x};
    }
};

using Vector = Point;

cin >> px >> py >> vx >> vy >> a >> b >> c >> d;

Point p = {px, py};
Vector v = {vx, vy};
v.normalize();
Vector w = v.rotate();

(p + v * b).print();
(p - w * (a / 2.)).print();
(p - w * (c / 2.)).print();
(p - w * (c / 2.) - v * d).print();
(p + w * (c / 2.) - v * d).print();
(p + w * (c / 2.)).print();
(p + w * (a / 2.)).print();

P Area of a Star

:n,r,n
:,OCABC,
S=2nSOAB
Experimental Educational Round: VolBIT Formulas Blitz(数学、组合数学)_第1张图片

double alpha = PI / n / 2, beta = PI / n;
double theta = alpha + beta;
double OC = r * sin(alpha), OB = OC / sin(theta);
double ans = n * OB * r * sin(beta);
printf("%.12f\n", ans);

Q Pyramids

:n
::
Experimental Educational Round: VolBIT Formulas Blitz(数学、组合数学)_第2张图片
θ=2π/n
OECDE,SOCE,OC=12lsin(12θ)
AOSBCDO,SAOC,AO=l2|OC|2
SBCD=nSOCD=n12|OC|2sin(θ)
S=13|AO|SBCD

int l[10];
double base, height;

void get(int n) {
    double theta = 2 * acos(-1) / n;
    double OC = 0.5 * l[n] / sin(theta / 2);
    base = n * (0.5 * OC * OC * sin(theta));
    height = sqrt(l[n] * l[n] - OC * OC);
}

for(int i = 3; i <= 5; ++i) scanf("%d", l + i);
double ans = 0;
for(int i = 3; i <= 5; ++i) {
    get(i);
    ans += base * height / 3;
}
printf("%.12f\n", ans);

R Game

:n×n,:,,
,1,2
:1×1,2×2,3×3,4×4,5×5,n,n
n,
puts(n & 1 ? "1" : "2");

你可能感兴趣的:(数学,组合数学)