字典树简介 字典树([latex]Trie[/latex],又叫前缀树)是一种 树形数据结构,常用于高效地存储和查找字符串集合。它的核心思想是:公共前缀只存储一次,不同字符串在前缀相同的部分共享路径。 定义 数据结构约定: [latex]tr[u][c]…
链接:https://atcoder.jp/contests/abc403 A - Odd Position Sum 算法: 模拟。 思路: 无。 关键代码: void miyan() { int n; cin >> n; ll ans = 0; for (int i = 0; i < …
链接:https://codeforces.com/contest/2149 A. Be Positive 算法: 数学。 思路: 无。 关键代码: void miyan() { int n; cin >> n; vector<int> a(n); for (auto &x : …
链接:https://atcoder.jp/contests/abc404 A - Not Found 算法: 模拟。 思路: 无。 关键代码: void miyan() { string s; cin >> s; vector<int> cnt(…
链接:https://atcoder.jp/contests/abc424 A - Isosceles 算法: 模拟。 思路: 无。 关键代码: void miyan() { int a, b, c; cin >> a >> b …
链接:https://codeforces.com/contest/2147 A. Shortest Increasing Path 算法: 找规律。 思路: 答案只有 [latex]-1[/latex] [latex]2[/latex] [latex]…
链接:https://atcoder.jp/contests/abc405 A - Is it rated? 算法: 模拟。 思路: 无。 关键代码: void miyan() { int r, c; cin >> r >> c; if (c == 1)…
链接:https://codeforces.com/contest/2144 A. Cut the Array 算法: 模拟。 思路: 无。 关键代码: void miyan() { int n; cin >> n; vector<in…
链接:https://atcoder.jp/contests/abc423 A - Scary Fee 算法: 模拟。 思路: 无。 关键代码: void miyan() { ll x, c; cin >> x >> c; cout << l…
链接:https://codeforces.com/contest/2148 A. Sublime Sequence 算法: 模拟。 思路: 无。 关键代码: void miyan() { int x, n; cin >> x >> n; if (n &…