码农吃枇杷
码农吃枇杷
全部文章
分类
题解(5)
归档
标签
去牛客网
登录
/
注册
码农吃枇杷的博客
全部文章
(共11篇)
题解 | #矩形覆盖#
3. 矩形覆盖 矩形覆盖_牛客题霸_牛客网 3.1 题目描述 题目描述:我们可以用 2*1 的小矩形横着或者竖着去覆盖更大的矩形。请问用 n 个 2*1 的小矩形无重叠地覆盖一个 2*n 的大矩形,从同一个方向看总共有多少种不同的方法? 实例1: 比如n=3时,2*3的矩形块有3种不同的覆盖方法(从...
2025-02-05
0
376
题解 | #二叉搜索树与双向链表#
解法1:中序遍历,将节点放到vector中,再改链接关系 class Solution { public: vector<TreeNode*> v; void InOrder(TreeNode* root) { if(root == nullptr) return; ...
2024-05-28
0
448
题解 | #空调遥控#
解法一:滑动窗口 // src:https://ac.nowcoder.com/acm/problem/229310 #include <climits> #include <complex> #include <iostream> #include <a...
C++
双指针
二分查找
2024-05-24
0
485
题解 | #打怪#
数学,o(1)时间复杂度 #include <iostream> using namespace std; using ll = long long; ll T, h, a,H,A; void solve() { cin>>h>>a>>H&...
C++
数学
2024-05-14
0
497
题解 | #非对称之美#
贪心 #include <bits/stdc++.h> using namespace std; string s; // 判断是否全是相同字母 bool CheckSame() { for(int i=0;i<s.size();++i) if(s[i]...
C++
贪心
脑筋急转弯
2024-05-11
0
579
题解 | #对称之美#
双指针+哈希模拟 #include <bits/stdc++.h> using namespace std; int T; vector<string> words; bool check() { bool flag=false; int left=0,...
C++
双指针
哈希表
2024-05-11
0
639
题解 | #比那名居的桃子3种解法#
// 暴力解法 #include<bits/stdc++.h> using namespace std; const int N = 1e5+10; using ll = long long; ll n, k, a[N], b[N]; int main() { cin>&g...
C++
双指针
前缀和
滑动窗口
2024-05-10
1
429
题解 | #最高分与最低分之差#
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; vec...
2023-05-22
0
303
题解 | #菱形图案#
#include <iostream> using namespace std; int main() { int n; while(cin >> n) { // 打印上半部分 for (int i = 0; i &l...
2023-04-22
0
280
题解 | #小乐乐与进制转换#
#include <iostream> #include <string> using namespace std; string DecToHex(int n) { string hex = ""; while (n) { int ...
2023-04-06
1
294
首页
上一页
1
2
下一页
末页