• 欢迎光临~

# AtCoder Beginner Contest 266

https://atcoder.jp/contests/abc266

EF 待补

## A - Middle Letter

``````#include <bits/stdc++.h>

using namespace std;

int main () {
string s;
cin >> s;
cout << s[(s.size()+1)/2-1];
}
``````

## B - Modulo Number

``````#include <bits/stdc++.h>
#define int long long

using namespace std;
const int mod = 998244353;
int n;

int MOD (int x) {
while (x < 0)   x += mod;
return x % mod;
}

signed main () {
cin >> n;
cout << MOD (n);
}

//倍数
//N与x同余
``````

(A = y_1-y_2, B = x_2-x_1, C = x_1*y_2 - x_2*y_1;)

``````#include<bits/stdc++.h>
#define int long long

using namespace std;
int x[5], y[5];

signed main () {
for (int i = 1; i <= 4; i++)    cin >> x[i] >> y[i];
//判两条对角线
int A, B, C, X, Y;

A = y[1] - y[3], B = x[3] - x[1], C = x[1]*y[3] - x[3]*y[1];
X = A*x[2] + B*y[2] + C, Y = A*x[4] + B*y[4] + C;
//cout << X << ' ' << Y << endl;
if (X * Y > 0) {
cout << "Non";
return 0;
}

A = y[2] - y[4], B = x[4] - x[2], C = x[2]*y[4] - x[4]*y[2];
X = A*x[1] + B*y[1] + C, Y = A*x[3] + B*y[3] + C;
if (X * Y > 0) {
cout << "Non";
return 0;
}
cout << "Yes";
}

//判断是否为凸多边形
//判断点是否在直线的两边
//Ax+By+C < 0
//A = y1-y2, B = x2-x1, C = x1y2 - x2y1;
``````

## D - Snuke Panic (1D)

``````#include <bits/stdc++.h>
#define endl "n"
#define int long long

using namespace std;
typedef pair<int, int> pii;
const int N = 1e5 + 5;
int n, m;
int f[N][7]; //第i秒时在位置j
int dx[] = {-1, 0, 1};

signed main () {
ios::sync_with_stdio (0);cin.tie(0);cout.tie(0);
memset (f, 0, sizeof f);
cin >> n;
for (int i = 0; i < n; i++) {
int ti, xi, ai;
cin >> ti >> xi >> ai;
f[ti][xi] = ai;
m = max (m, ti);
}
//cout << "m=" << m << endl;

for (int t = m-1; t >= 0; t--) {
f[t][0] += max (f[t+1][0], f[t+1][1]);
for (int x = 1; x < 4; x++) {
f[t][x] += max (f[t+1][x], max (f[t+1][x+1], f[t+1][x-1]));
}
f[t][4] += max (f[t+1][4], f[t+1][3]);
cout << endl;
}

cout << f[0][0] << endl;
}
``````