A、签到

print('祝贺祖国成立70周年!')
B、欧涛的烦恼



#include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define all(__vv__) (__vv__).begin(), (__vv__).end()
#define endl "\n"
#define pai pair<int, int>
#define ms(__x__,__val__) memset(__x__, __val__, sizeof(__x__))
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
inline ll read() { ll s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') w = -1; for (; isdigit(ch); ch = getchar()) s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; }
inline void print(ll x, int op = 10) { if (!x) { putchar('0'); if (op) putchar(op); return; } char F[40]; ll tmp = x > 0 ? x : -x; if (x < 0)putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0)putchar(F[--cnt]); if (op) putchar(op); }
inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll qpow(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans *= a; b >>= 1; a *= a; } return ans; } ll qpow(ll a, ll b, ll mod) { ll ans = 1; while (b) { if (b & 1)(ans *= a) %= mod; b >>= 1; (a *= a) %= mod; }return ans % mod; }
const int dir[][2] = { {0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1} };
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 7;
int main() {
int T = 1;
T = read();
while (T--) {
int n = read(), sum = 0;
for (int i = 1; i <= n; ++i) sum += read();
sum = ceil(1.0 * sum / n);
print(sum);
}
return 0;
}
C、欧涛最短路




%E7%9A%84%E5%A4%8D%E6%9D%82%E5%BA%A6&preview=true)




#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define all(__vv__) (__vv__).begin(), (__vv__).end()
#define endl "\n"
#define pai pair<double, int>
#define ms(__x__,__val__) memset(__x__, __val__, sizeof(__x__))
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
inline ll read() { ll s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') w = -1; for (; isdigit(ch); ch = getchar()) s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; }
inline void print(ll x, int op = 10) { if (!x) { putchar('0'); if (op) putchar(op); return; } char F[40]; ll tmp = x > 0 ? x : -x; if (x < 0)putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0)putchar(F[--cnt]); if (op) putchar(op); }
inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll qpow(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans *= a; b >>= 1; a *= a; } return ans; } ll qpow(ll a, ll b, ll mod) { ll ans = 1; while (b) { if (b & 1)(ans *= a) %= mod; b >>= 1; (a *= a) %= mod; }return ans % mod; }
const int dir[][2] = { {0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1} };
const int MOD = 1e9 + 7;
const double INF = 1e18;
const double eps = 1e-4;
const int N = 600 + 7;
struct Node {
double x, y, z;
double calc(const Node& A) const {
return sqrt((x - A.x) * (x - A.x) + (y - A.y) * (y - A.y) + (z - A.z) * (z - A.z));
}
}a[N];
vector<pai> edge[N];
vector<int> ans[N];
int vis[N];
double dis[N];
void dijkstra(int s) {
fill(dis, dis + N, 1e18);
dis[s] = 0.0;
ans[s].clear();
ms(vis, 0);
priority_queue<pai, vector<pai>, greater<pai>> pq;
pq.push({ 0.0,s });
while (pq.size()) {
int u = pq.top().second;
double w = pq.top().first;
pq.pop();
if (vis[u]) continue;
vis[u] = 1;
for (auto& it : edge[u]) {
double w = it.first;
int v = it.second;
if (dis[v] > dis[u] + w) {
dis[v] = dis[u] + w;
pq.push({ dis[v],v });
ans[v] = ans[u];
ans[v].push_back(v);
}
}
}
}
int main() {
int T = 1;
//T = read();
while (T--) {
int n;
double m;
scanf("%d %lf", &n, &m);
scanf("%lf %lf %lf %lf %lf %lf", &a[0].x, &a[0].y, &a[0].z, &a[n + 1].x, &a[n + 1].y, &a[n + 1].z);
for (int i = 1; i <= n; ++i)
scanf("%lf %lf %lf", &a[i].x, &a[i].y, &a[i].z);
++n;
for (int i = 0; i <= n; ++i)
for (int j = i + 1; j <= n; ++j) {
double tmp = a[i].calc(a[j]);
if (tmp <= m) {
edge[i].push_back({ tmp,j });
edge[j].push_back({ tmp,i });
}
}
dijkstra(0);
if (fabs(dis[n] - INF) < eps) puts("-1");
else {
printf("%.3f\n", dis[n]);
printf("Start ");
int len = ans[n].size();
for (int i = 0; i < len - 1; ++i)
printf("%d ", ans[n][i]);
printf("End\n");
}
}
return 0;
}
D、欧涛C 甜甜圈


#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define all(__vv__) (__vv__).begin(), (__vv__).end()
#define endl "\n"
#define pai pair<int, int>
#define ms(__x__,__val__) memset(__x__, __val__, sizeof(__x__))
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
inline ll read() { ll s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') w = -1; for (; isdigit(ch); ch = getchar()) s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; }
inline void print(ll x, int op = 10) { if (!x) { putchar('0'); if (op) putchar(op); return; } char F[40]; ll tmp = x > 0 ? x : -x; if (x < 0)putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0)putchar(F[--cnt]); if (op) putchar(op); }
inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll qpow(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans *= a; b >>= 1; a *= a; } return ans; } ll qpow(ll a, ll b, ll mod) { ll ans = 1; while (b) { if (b & 1)(ans *= a) %= mod; b >>= 1; (a *= a) %= mod; }return ans % mod; }
const int dir[][2] = { {0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1} };
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 7;
char s[1007];
int main() {
int T = 1;
T = read();
while (T--) {
scanf("%s", s);
int ans = 0;
for (int i = 0; s[i]; ++i)
if (s[i] == '0' or s[i] == '4' or s[i] == '6' or s[i] == '9')
++ans;
else if (s[i] == '8')
ans += 2;
print(ans);
}
return 0;
}
E、欧涛爬树





#pragma GCC target("avx,sse2,sse3,sse4,popcnt")
#pragma GCC optimize("O2,O3,Ofast,inline,unroll-all-loops,-ffast-math")
#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define all(__vv__) (__vv__).begin(), (__vv__).end()
#define endl "\n"
#define pai pair<int, int>
#define ms(__x__,__val__) memset(__x__, __val__, sizeof(__x__))
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
inline ll read() { ll s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') w = -1; for (; isdigit(ch); ch = getchar()) s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; }
inline void print(ll x, int op = 10) { if (!x) { putchar('0'); if (op) putchar(op); return; } char F[40]; ll tmp = x > 0 ? x : -x; if (x < 0)putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0)putchar(F[--cnt]); if (op) putchar(op); }
inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll qpow(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans *= a; b >>= 1; a *= a; } return ans; } ll qpow(ll a, ll b, ll mod) { ll ans = 1; while (b) { if (b & 1)(ans *= a) %= mod; b >>= 1; (a *= a) %= mod; }return ans % mod; }
const int dir[][2] = { {0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1} };
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 5e6 + 7;
const int base = 131; // hash倍数
int head[N], tot = 0;//前向星变量
struct Node {
//int u; //起点
//int w; //权值
int v, next;
} edge[N << 1];
void add(int u, int v) {
tot++;
//edge[tot].u = u;
edge[tot].v = v;
//edge[tot].w = w;
edge[tot].next = head[u];
head[u] = tot;
}
char s[N];
unordered_set<ull> st;
void dfs(int u, int fa, ull val) {
ull now = val * base + s[u]; // 字符串hash值
bool flag = 1;
for (int i = head[u]; i; i = edge[i].next) {
int v = edge[i].v;
if (v == fa) continue;
dfs(v, u, now);
flag = 0;
}
if (flag) st.insert(now); //叶子节点就插入当前字符串的 hash 值
}
int main() {
int n;
//T = read();
while (~scanf("%d", &n)) {
st.clear();
ms(head, 0);
scanf("%s", s + 1);
for (int i = 1; i < n; ++i) {
int u = read(), v = read();
add(u, v);
add(v, u);
}
dfs(1, 0, 0);
print(st.size());
}
return 0;
}
F、欧涛B



#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define all(__vv__) (__vv__).begin(), (__vv__).end()
#define endl "\n"
#define pai pair<int, int>
#define ms(__x__,__val__) memset(__x__, __val__, sizeof(__x__))
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
inline ll read() { ll s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') w = -1; for (; isdigit(ch); ch = getchar()) s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; }
inline void print(ll x, int op = 10) { if (!x) { putchar('0'); if (op) putchar(op); return; } char F[40]; ll tmp = x > 0 ? x : -x; if (x < 0)putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0)putchar(F[--cnt]); if (op) putchar(op); }
inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll qpow(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans *= a; b >>= 1; a *= a; } return ans; } ll qpow(ll a, ll b, ll mod) { ll ans = 1; while (b) { if (b & 1)(ans *= a) %= mod; b >>= 1; (a *= a) %= mod; }return ans % mod; }
const int dir[][2] = { {0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1} };
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 7;
int main() {
int T = 1;
T = read();
while (T--) {
bool flag = true;
int t = read(), maxx = read(), maxy = read(), n = read();
int prex = read(), prey = read(), op = read();
int x, y, tmp1 = 0, tmp2 = 0;
while (--n) {
x = read(), y = read(), op = read();
tmp1 += abs((x - prex) * t);
tmp2 += abs((y - prey) * t);
if (tmp1 > maxx or tmp2 > maxy) flag = false;
if (op == 0) tmp1 = 0;
else tmp2 = 0;
prex = x, prey = y;
}
if (flag) puts("YES");
else puts("NO");
}
return 0;
}
G、数据结构

H、谁在说谎













)%20j%20%5Cin%20%E5%87%BA%E7%8E%B0%E8%BF%87%E7%9A%84%E5%8C%BA%E9%97%B4%E5%B7%A6%E7%AB%AF%E7%82%B9&preview=true)
#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define all(__vv__) (__vv__).begin(), (__vv__).end()
#define endl "\n"
#define pai pair<int, int>
#define ms(__x__,__val__) memset(__x__, __val__, sizeof(__x__))
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
inline ll read() { ll s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') w = -1; for (; isdigit(ch); ch = getchar()) s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; }
inline void print(ll x, int op = 10) { if (!x) { putchar('0'); if (op) putchar(op); return; } char F[40]; ll tmp = x > 0 ? x : -x; if (x < 0)putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0)putchar(F[--cnt]); if (op) putchar(op); }
inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll qpow(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans *= a; b >>= 1; a *= a; } return ans; } ll qpow(ll a, ll b, ll mod) { ll ans = 1; while (b) { if (b & 1)(ans *= a) %= mod; b >>= 1; (a *= a) %= mod; }return ans % mod; }
const int dir[][2] = { {0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1} };
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 7;
map<pai, int> mp;
vector<int> p[N];
int dp[N];
int main() {
int n = read();
for (int i = 1; i <= n; ++i) {
int l = read() + 1, r = n - read();
if (l > r) continue;
++mp[{l, r}];
if (mp[{l, r}] == 1) p[r].push_back(l);
}
for (int i = 1; i <= n; ++i) {
dp[i] = dp[i - 1];
for (auto& j : p[i])
dp[i] = max(dp[i], dp[j - 1] + min(mp[{j, i}], i - j + 1));
}
print(n - dp[n]);
return 0;
}
I、不要666



#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define all(__vv__) (__vv__).begin(), (__vv__).end()
#define endl "\n"
#define pai pair<int, int>
#define ms(__x__,__val__) memset(__x__, __val__, sizeof(__x__))
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
inline ll read() { ll s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') w = -1; for (; isdigit(ch); ch = getchar()) s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; }
inline void print(ll x, int op = 10) { if (!x) { putchar('0'); if (op) putchar(op); return; } char F[40]; ll tmp = x > 0 ? x : -x; if (x < 0)putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0)putchar(F[--cnt]); if (op) putchar(op); }
inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll qpow(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans *= a; b >>= 1; a *= a; } return ans; } ll qpow(ll a, ll b, ll mod) { ll ans = 1; while (b) { if (b & 1)(ans *= a) %= mod; b >>= 1; (a *= a) %= mod; }return ans % mod; }
const int dir[][2] = { {0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1} };
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 7;
int num[25];
ll bs[25];
struct Node {
int cnt = -1;
ll sum = 0;
}dp[25][10][10];
Node dfs(int len, int num1, int num2, bool limit) {
if (!len) {
if (num1 == 0 or num2 == 0) return { 0,0 };
else return { 1,0 };
}
if (!limit && ~dp[len][num1][num2].cnt)
return dp[len][num1][num2];
int up = limit ? num[len] : 9;
Node ans;
ans.cnt = 0;
for (int i = 0; i <= up; ++i) {
if (i == 6) continue;
Node tmp = dfs(len - 1, (num1 + i) % 6, (num2 * 10 + i) % 6, limit && i == up);
ans.cnt = (ans.cnt + tmp.cnt) % MOD;
ans.sum = (ans.sum + tmp.sum + i * bs[len] * tmp.cnt % MOD) % MOD;
}
if (!limit) dp[len][num1][num2] = ans;
return ans;
}
ll slove(ll n) {
int cnt = 0;
while (n) {
num[++cnt] = n % 10;
n /= 10;
}
return dfs(cnt, 0, 0, true).sum;
}
int main() {
ll n, m;
bs[1] = 1;
for (int i = 2; i < 25; ++i) bs[i] = bs[i - 1] * 10 % MOD;
while (~scanf("%lld %lld", &n, &m)) {
printf("%lld\n", (slove(m) - slove(n - 1) + MOD) % MOD);
}
return 0;
}
J、组合技

K、这个勇者明明超强却过分慎重
%20%3D%204*f(n-1)%2B3*f(n-2)%2Cf(1)%3D4%2Cf(2)%3D233%2C%20MOD%20%3D%20666666&preview=true)
%E7%9A%84%E7%BB%93%E6%9E%9C&preview=true)

#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
typedef long long ll;
inline ll read() { ll s = 0, w = 1; char ch = getchar(); while (ch < 48 || ch > 57) { if (ch == '-') w = -1; ch = getchar(); } while (ch >= 48 && ch <= 57) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar(); return s * w; }
const int mod = 666666;
const int N = 2; //矩阵规模
const int M = 2;
struct Node {
ll matrix[N][M];//结构体中的矩阵
Node() {//默认构造函数
memset(matrix, 0, sizeof(matrix));
}
void one() {//单位矩阵
for (int i = 0; i < N; ++i)
matrix[i][i] = 1;
}
Node operator*(Node other) {//矩阵运算重载*运算符
Node ans;//记录乘积
for (int i = 0; i < N; i++)
for (int j = 0; j < M; j++)
for (int k = 0; k < N; k++) {
ans.matrix[i][j] += matrix[i][k] * other.matrix[k][j];
ans.matrix[i][j] %= mod;
}
return ans;
}
};
Node power(Node a, ll b) {//快速幂求a的b次方
Node res;
res.one();//单位矩阵
while (b) {
if (b & 1)
res = res * a;
a = a * a;
b >>= 1;
}
return res;
}
int main() {
Node st, p;
st.matrix[0][0] = 4;
st.matrix[0][1] = 233;
p.matrix[0][1] = 3;
p.matrix[1][0] = 1;
p.matrix[1][1] = 4;
int n, m;
while(~scanf("%d %d", &n, &m))
printf("%d\n", m - (st * power(p, n - 1)).matrix[0][0]);
return 0;
}