牛客754201929号
牛客754201929号
全部文章
分类
题解(2)
归档
标签
去牛客网
登录
/
注册
牛客754201929号的博客
全部文章
(共8篇)
题解 | #蛇形矩阵#
将矩阵转45°后进行存储和遍历输出,边界条件更好判断 #include <iostream> using namespace std; const int N = 1010; int out[2*N][2*N]; int n; int main() { cin >>...
C++
2026-02-25
1
26
题解 | 路径打印
法一先对字符串排序,相同前缀的路径下标是连续的 #include <iostream> #include <algorithm> #include <vector> using namespace std; const int N = 15; string s...
2026-02-23
1
39
题解 | 手机键盘
预处理,将26个字符的所属组、耗时 存于两数组 g[26], t[26]。遍历字符串,和前一字符同组加额外2t耗时(用一个假前驱可免去第一个字符的特判) #include <iostream> using namespace std; string a[] = { "ab...
2026-02-23
0
28
题解 | 剩下的树
可应用区间合并的模板 #include <iostream> #include <vector> #include <algorithm> using namespace std; typedef pair<int, int> PII; int ...
2026-02-23
0
45
题解 | 日期差值
按月算或按天算,一直加到第二个日期按月统计: #include <iostream> using namespace std; int days[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; bool is_r...
2026-02-22
0
16
题解 | 打印日期
#include <iostream> using namespace std; int days[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; bool is_run(int y) { return (y ...
2026-02-22
0
23
题解 | Repeater
分层求每个元素映射到模板的位置 #include <iostream> #include <cstring> using namespace std; char mod[5][5], ch; int n, q, sz; // a的k次方(cmath的pow是浮点运算) ...
2026-02-21
0
18
题解 | #叠筐#
几何法 依据到中心点的层数来选择输出的元素 #include <iostream> #include <algorithm> using namespace std; int n; char center, outer; int main() { while (cin...
C++
2026-02-19
0
29