diff --git a/TangDou/AcWing/NumTriangle/1015.md b/TangDou/AcWing_TiGao/T1/1015.md similarity index 100% rename from TangDou/AcWing/NumTriangle/1015.md rename to TangDou/AcWing_TiGao/T1/1015.md diff --git a/TangDou/AcWing/NumTriangle/1015_Dfs.cpp b/TangDou/AcWing_TiGao/T1/1015_Dfs.cpp similarity index 100% rename from TangDou/AcWing/NumTriangle/1015_Dfs.cpp rename to TangDou/AcWing_TiGao/T1/1015_Dfs.cpp diff --git a/TangDou/AcWing/NumTriangle/1015_Dfs_JiYIHua.cpp b/TangDou/AcWing_TiGao/T1/1015_Dfs_JiYIHua.cpp similarity index 100% rename from TangDou/AcWing/NumTriangle/1015_Dfs_JiYIHua.cpp rename to TangDou/AcWing_TiGao/T1/1015_Dfs_JiYIHua.cpp diff --git a/TangDou/AcWing/NumTriangle/1015_ErWei.cpp b/TangDou/AcWing_TiGao/T1/1015_ErWei.cpp similarity index 100% rename from TangDou/AcWing/NumTriangle/1015_ErWei.cpp rename to TangDou/AcWing_TiGao/T1/1015_ErWei.cpp diff --git a/TangDou/AcWing/NumTriangle/1015_YiWei.cpp b/TangDou/AcWing_TiGao/T1/1015_YiWei.cpp similarity index 100% rename from TangDou/AcWing/NumTriangle/1015_YiWei.cpp rename to TangDou/AcWing_TiGao/T1/1015_YiWei.cpp diff --git a/TangDou/AcWing/NumTriangle/1018.md b/TangDou/AcWing_TiGao/T1/1018.md similarity index 100% rename from TangDou/AcWing/NumTriangle/1018.md rename to TangDou/AcWing_TiGao/T1/1018.md diff --git a/TangDou/AcWing/NumTriangle/1018_ErWei.cpp b/TangDou/AcWing_TiGao/T1/1018_ErWei.cpp similarity index 100% rename from TangDou/AcWing/NumTriangle/1018_ErWei.cpp rename to TangDou/AcWing_TiGao/T1/1018_ErWei.cpp diff --git a/TangDou/AcWing/NumTriangle/1018_YiWei.cpp b/TangDou/AcWing_TiGao/T1/1018_YiWei.cpp similarity index 100% rename from TangDou/AcWing/NumTriangle/1018_YiWei.cpp rename to TangDou/AcWing_TiGao/T1/1018_YiWei.cpp diff --git a/TangDou/AcWing/NumTriangle/1027.md b/TangDou/AcWing_TiGao/T1/1027.md similarity index 100% rename from TangDou/AcWing/NumTriangle/1027.md rename to TangDou/AcWing_TiGao/T1/1027.md diff --git a/TangDou/AcWing/NumTriangle/1027_0.cpp b/TangDou/AcWing_TiGao/T1/1027_0.cpp similarity index 100% rename from TangDou/AcWing/NumTriangle/1027_0.cpp rename to TangDou/AcWing_TiGao/T1/1027_0.cpp diff --git a/TangDou/AcWing/NumTriangle/1027_1.cpp b/TangDou/AcWing_TiGao/T1/1027_1.cpp similarity index 100% rename from TangDou/AcWing/NumTriangle/1027_1.cpp rename to TangDou/AcWing_TiGao/T1/1027_1.cpp diff --git a/TangDou/AcWing/NumTriangle/1027_2.cpp b/TangDou/AcWing_TiGao/T1/1027_2.cpp similarity index 100% rename from TangDou/AcWing/NumTriangle/1027_2.cpp rename to TangDou/AcWing_TiGao/T1/1027_2.cpp diff --git a/TangDou/AcWing/NumTriangle/275.cpp b/TangDou/AcWing_TiGao/T1/275.cpp similarity index 100% rename from TangDou/AcWing/NumTriangle/275.cpp rename to TangDou/AcWing_TiGao/T1/275.cpp diff --git a/TangDou/AcWing/NumTriangle/275.md b/TangDou/AcWing_TiGao/T1/275.md similarity index 92% rename from TangDou/AcWing/NumTriangle/275.md rename to TangDou/AcWing_TiGao/T1/275.md index 94cbbb2..6f7bdd0 100644 --- a/TangDou/AcWing/NumTriangle/275.md +++ b/TangDou/AcWing_TiGao/T1/275.md @@ -96,18 +96,13 @@ $1≤n,m≤50$ 因此,我们可以通过微调其中的一条路线,使之不经过重合点 $C$,同时路线的总价值没有减少 -**得证**:最优解路线可以是不经过重复路线的 (部分证明方法参照了 [第一赞的题解](https://www.acwing.com/solution/content/12389/)了) +**得证**:最优解路线可以是不经过重复路线的 接下来就是完全参照 $AcWing$ $1027$. 方格取数 的$DP$分析了 -关于 **重合格子** 判断一些条件都在这篇博客里详细写了 - -这里我偷个懒,直接用我上篇博客的内容了 ~~(既然是我自己写的应该不算抄袭吧!)~~ - ![20220930165932](https://cdn.jsdelivr.net/gh/littlehb/ShaoHuiLin/20220930165932.png) -### Code(三重迭代写法) **集合划分**
diff --git a/TangDou/LanQiaoBei/LanQiao14STEMA20230212/2.cpp b/TangDou/LanQiaoBei/LanQiao14STEMA20230212/2.cpp new file mode 100644 index 0000000..5dd0d91 --- /dev/null +++ b/TangDou/LanQiaoBei/LanQiao14STEMA20230212/2.cpp @@ -0,0 +1,20 @@ +#include +using namespace std; +int main() { + int n, m; + cin >> n >> m; + int cnt = 0; + for (int i = n; i <= m; i++) { + int x = i; + bool flag = false; + while (x) { + int a = x % 10; + if (a % 2 == 0) flag = true; + x /= 10; + } + if (!flag) cnt++; + } + cout << cnt << endl; + + return 0; +} diff --git a/TangDou/LanQiaoBei/LanQiao14STEMA20230212/8.cpp b/TangDou/LanQiaoBei/LanQiao14STEMA20230212/8.cpp new file mode 100644 index 0000000..3ea813d --- /dev/null +++ b/TangDou/LanQiaoBei/LanQiao14STEMA20230212/8.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; +int main() { + int n, cnt = 0; + cin >> n; + cnt = n / 3; + if (n == 2) + cnt = -1; + else if (n == 4) + cnt = 4; + else if (n % 3 == 1) + cnt += 1; + else if (n % 3 == 2) + cnt += 2; + + cout << cnt << endl; + return 0; +} \ No newline at end of file diff --git a/TangDou/LanQiaoBei/LanQiao14STEMA20230212/题解.md b/TangDou/LanQiaoBei/LanQiao14STEMA20230212/题解.md new file mode 100644 index 0000000..7bc7009 --- /dev/null +++ b/TangDou/LanQiaoBei/LanQiao14STEMA20230212/题解.md @@ -0,0 +1,3 @@ +https://blog.csdn.net/qq_36230375/article/details/134725732 + +https://tiku.scratchor.com/paper/view/gjfvsjrgtpm30v3f \ No newline at end of file diff --git a/TangDou/LanQiaoBei/LanQiao15STEMA20231217/10.cpp b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/10.cpp new file mode 100644 index 0000000..df981a0 --- /dev/null +++ b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/10.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; +int k; +string kill(string s) { + int p = 0; + for (int i = 0; i < s.size() - 1; i++) + if (s[i + 1] > s[i]) { + p = i; + break; + } + + string res; + for (int i = 0; i < s.size(); i++) + if (i != p) res += s[i]; + return res; +} + +int main() { + string s; + cin >> s; + + cin >> k; + for (int i = 1; i <= k; i++) s = kill(s); + cout << s << endl; + return 0; +} \ No newline at end of file diff --git a/TangDou/LanQiaoBei/LanQiao15STEMA20231217/11.cpp b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/11.cpp new file mode 100644 index 0000000..7c08cb7 --- /dev/null +++ b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/11.cpp @@ -0,0 +1,49 @@ +#include +using namespace std; +const int N = 100010; +vector g[N]; // 邻接表,一个正图,一个反图 +int c[N]; // 每个树洞中松鼠的数量 +/* +测试用例 +4 +5 +3 +6 +1 +1 2 +1 3 +2 4 +2 +*/ +int dfs(int u, int fa, int k) { + if (k == 0) return c[u]; + int sum = c[u]; + for (int i = 0; i < g[u].size(); i++) { + if (g[u][i] == fa) continue; + sum += dfs(g[u][i], u, k - 1); + } + return sum; +} + +int main() { +#ifndef ONLINE_JUDGE + freopen("11.in", "r", stdin); +#endif + + int n; // 树洞的数量 + cin >> n; + + for (int i = 1; i <= n; i++) cin >> c[i]; // 每个树洞中松鼠的数量 + + for (int i = 1; i < n; i++) { + int a, b; // 表示两个树洞相连接 + cin >> a >> b; + g[a].push_back(b); // 用邻接表保存一下某个树洞与哪两个其它树洞相连接 + g[b].push_back(a); + } + + int k; + cin >> k; + for (int i = 1; i <= n; i++) cout << dfs(i, -1, k) << endl; + return 0; +} \ No newline at end of file diff --git a/TangDou/LanQiaoBei/LanQiao15STEMA20231217/11.in b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/11.in new file mode 100644 index 0000000..14224a9 --- /dev/null +++ b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/11.in @@ -0,0 +1,9 @@ +4 +5 +3 +6 +1 +1 2 +1 3 +2 4 +2 \ No newline at end of file diff --git a/TangDou/LanQiaoBei/LanQiao15STEMA20231217/5.cpp b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/5.cpp new file mode 100644 index 0000000..8bae870 --- /dev/null +++ b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/5.cpp @@ -0,0 +1,14 @@ +#include +using namespace std; +int func(int x, int y, int z) { + if (x == 1 || y == 1 || z == 1) return 1; + if (x < y && x < z) + return func(x, y - 1, z) + func(x, y, z - 1); + if (y < x && y < z) + return func(x - 1, y, z) + func(x, y, z - 1); + return func(x - 1, y, z) + func(x, y - 1, z); +} +int main() { + cout << func(3, 3, 2); + return 0; +} \ No newline at end of file diff --git a/TangDou/LanQiaoBei/LanQiao15STEMA20231217/5.md b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/5.md new file mode 100644 index 0000000..a7f5536 --- /dev/null +++ b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/5.md @@ -0,0 +1,36 @@ +```cpp {.line-numbers} +int func( int x, int y, int z ) +{ + if( x == 1 || y == 1 || z == 1 ) return 1; + if( x < y && x < z ) + return func( x, y - 1, z ) + func( x, y, z - 1 ); + if( y < x && y < z ) + return func( x - 1, y, z ) + func( x, y, z - 1 ); + return func( x - 1, y, z ) + func( x, y - 1, z ); +} +int main() +{ + cout << func( 3, 3, 2 ); + return 0; +} +``` +将$func()$简写成$f()$ + +人脑模拟电脑 + +$f(3,3,2)=f(2,3,2)+f(3,2,2)$ + +其中 +$f(2,3,2)=f(1,3,2)+f(2,2,2)$ ① +$f(3,2,2)=f(2,2,2)+f(3,1,2)$ ② + +最终$res=①+②$ + +$f(1,3,2)=1$ +$f(2,2,2)=f(1,2,2)+f(2,1,2)=1+1=2$ + +$\therefore$ ①=3 + +②=3 + +①+②=6 diff --git a/TangDou/LanQiaoBei/LanQiao15STEMA20231217/9.cpp b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/9.cpp new file mode 100644 index 0000000..0b2e4de --- /dev/null +++ b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/9.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; + +int main() { + string s; + cin >> s; + + int m; + cin >> m; + m--; + + while (m--) { + string t; + for (int i = 0; i < s.size(); i++) { + int c = 1; + while (i + 1 < s.size() && s[i + 1] == s[i]) { + c++; + i++; + } + t = t + to_string(c) + s[i]; + } + s = t; + } + cout << s << endl; + return 0; +} diff --git a/TangDou/LanQiaoBei/LanQiao15STEMA20231217/试题.txt b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/试题.txt new file mode 100644 index 0000000..30c6074 --- /dev/null +++ b/TangDou/LanQiaoBei/LanQiao15STEMA20231217/试题.txt @@ -0,0 +1 @@ +https://tiku.scratchor.com/paper/view/z8k4y0xsf0ue8xlh diff --git a/TangDou/Test/TestA.cpp b/TangDou/Test/TestA.cpp index 1b6071b..9f73825 100644 --- a/TangDou/Test/TestA.cpp +++ b/TangDou/Test/TestA.cpp @@ -1,27 +1,26 @@ #include - using namespace std; -/** - 8 - 4 2 - 1 - 2 2 - 3 3 3 - 4 4 4 4 -*/ -int n, sum; int main() { - cin >> n; - for (int i = 1;; i++) { - n -= i; - if (n <= 0) { - // cout << i << " " << i + n << endl; - sum += i * (i + n); // 最后一行 - for (int j = 1; j < i; j++) sum += j * j; - cout << sum << endl; - break; + string s; + cin >> s; + + int m; + cin >> m; + m--; + + while (m--) { + string t; + for (int i = 0; i < s.size(); i++) { + int c = 1; + while (i + 1 < s.size() && s[i + 1] == s[i]) { + c++; + i++; + } + t = t + to_string(c) + s[i]; } + s = t; } + cout << s << endl; return 0; -} \ No newline at end of file +} diff --git a/小乔证件/蓝桥杯报名.txt b/小乔证件/蓝桥杯报名.txt index 35fc9a2..b2b7f9f 100644 --- a/小乔证件/蓝桥杯报名.txt +++ b/小乔证件/蓝桥杯报名.txt @@ -5,19 +5,7 @@ https://www.lanqiaoqingshao.cn/home 黄琬乔 220105201212060427 -办法 -1、使用qq截图功能,(随意找一个聊天框,然后点击小剪刀功能),然后在图片的下方有一个识别文字的功能,很好用。 -截图快捷键: ctrl+alt+a - -2、复制粘贴到ChatGPT,让它来帮助给出答案,但似乎有时它的回复不正确。 - https://tongyi.aliyun.com/ kgdxpr@163.com DsideaL4r5t6y7u!@# - - -(1) 用加速猫翻墙 -(2) https://chat.forefront.ai/ -superhuanghai@gmail.com -mdcija780522