# A 秦皇炒饭

### source: Pxt

#include<cstdio>
using namespace std;
int i,n;
int main()
{
scanf("%d",&n);
if(n>1) n/=2;
for(i=1;i<=n;++i) printf("Wed.Strong");
return 0;
}

# B 摩天乐

### source: Range

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;

long long n, m, l, r, a, b, c, d;
int main()
{
int T; cin >> T;
while (T--)
{
cin >> n >> m >> l >> r >> a >> b >> c >> d;
if (a == c)
{
cout << abs(b-d) << endl;
continue;
}
long long ans = 0;
if (b <= l || b >= r)
{
ans = abs(a-c) + abs(b-d);
}
else
{
long long cost1 = b-l+abs(d-l)+abs(a-c);
long long cost2 = r-b+abs(r-d)+abs(a-c);
ans = min(cost1, cost2);
}
cout << ans << endl;
}
return 0;
}

# C Akane

### source: meltout

#include <cstdio>
#include <algorithm>

using namespace std;

const int maxN=1e6+5;

int a[maxN];

int main()
{
int k,n,m,x;
scanf("%d%d",&n,&m);
for(k=0;k<n;k++)
{
scanf("%d",&x);
a[x%m]++;
}
int ans=max(0,a[0]-1);
for(k=1;k<(m+1)/2;k++)
{
ans+=min(a[k],a[m-k])*2;
if(a[k]==a[m-k] && a[k]!=0)ans--;
}
if(m%2==0)ans+=max(0,a[m/2]-1);
printf("%d",ans);
return 0;
}

# D 强哥打电话

### source: zhsq11, forgottencsc

#include <cstdio>
#include <iostream>
using namespace std;

const int Time_Max = 24 * 60 * 60;
const int MAXN = 100 + 10;
int From[MAXN], To[MAXN]; int N;
int Qiang_Time, Qiang_Interval, Qiang_Wait;

int Time_Conversion()
{
int hour, min, sec;
scanf("%d:%d:%d", &hour, &min, &sec);
return hour * 60 * 60 + min * 60 + sec;
}

void output(int seconds)
{
int hour = seconds / (60 * 60);
int min = (seconds - hour * (60 * 60)) / 60;
int sec = seconds - hour * (60 * 60) - min * 60;
if(seconds >= Time_Max)
printf("-1\n");
else
printf("%02d:%02d:%02d\n", hour, min, sec);
exit(0);
}

{
cin >> N;
int h1, m1, s1, h2, m2, s2;
for(int i = 0;i < N; ++i)
{
From[i] = Time_Conversion();
To[i] = Time_Conversion();
}
Qiang_Time = Time_Conversion();
Qiang_Interval = Time_Conversion();
Qiang_Wait = Time_Conversion();
return;
}

void find()
{
for(int i = 0;i < N; ++i)
{
while(Qiang_Time <= To[i])
{
if(Qiang_Time < From[i])
output(Qiang_Time);
if(Qiang_Time + Qiang_Wait >= To[i])
output(To[i]);
Qiang_Time += Qiang_Interval;
}
}
output(Qiang_Time);
return;
}

int main()
{
return 0;
}

# E  暴击猫

### source: moe

$f[i][j]$表示第j次攻击前有i 层buff的概率，在无限次攻击后i将会无意义，也就是说$f[i]$会收敛。所以用$f[i]$表示无限次数攻击后有i层buff的概率。$f[0]$显然为p，$f[1]$为p*(1-p)，以此类推，$f[n-1]=p*(1-p)^{n-1}$ 。注意因为有buff层数上限所以$f[n]=(f[n-1]+f[n])*(1-p)$，解得$f[n]=(1-p)^n$ 。剩下的就是算期望再作比了。

#include <bits/stdc++.h>
using namespace std;

int main()
{
double p, k, a;
int n;
scanf("%lf%lf%lf%d", &p, &k, &a, &n);
double init = p * k + (1 - p) * 100;
double res = 0, base = p;
for (int i = 1; i <= n; i++)
{
res += base * (k + a * (i - 1)) * p;
base = base * (1 - p);
}
res += base * (k + n * a);
res += (1 - p) * 100;
printf("%.3lf", res / init);
return 0;
}