上一页 1 2 3 4 5 6 ··· 22 下一页

2025年6月9日

摘要: A. False Alarm 只有当遇到关着的门才需要使用能力,标记最左侧关着的门为l,最右侧的关着的门为r,那么如果r-l+1>x则不能通过。 1 #include <iostream> 2 using namespace std; 3 /* run this program using the 阅读全文
posted @ 2025-06-09 21:09 greenofyu 阅读(13) 评论(0) 推荐(0)

2025年3月23日

摘要: A:船上可以装载的最大集装箱数量 简单题,直接取min就可以了。 1 class Solution { 2 public: 3 int maxContainers(int n, int w, int maxWeight) { 4 return min(n*n, maxWeight/w); 5 } 6 阅读全文
posted @ 2025-03-23 23:41 greenofyu 阅读(10) 评论(0) 推荐(0)

2024年12月20日

摘要: QT安装的组件需要勾选相应的mingw组件才会生成qmake.exe文件。 如果勾选了mingw组件还是没有qmake.exe的话,那么很大概率是QT检测到你的电脑中已经存在了mingw编译器,所以需要将环境变量中的包含mingw的路径给删除。然后再重新安装QT。 阅读全文
posted @ 2024-12-20 19:14 greenofyu 阅读(1053) 评论(0) 推荐(0)

2024年12月16日

摘要: https://codeforces.com/contest/2044 A. Easy Problem 签到题。对于大小为n的矩阵,有n-1个a>0&&b>0的(a,b)pair,满足b=n-a。 #include <iostream> #include <map> #include <string 阅读全文
posted @ 2024-12-16 18:27 greenofyu 阅读(51) 评论(0) 推荐(0)

2024年12月15日

摘要: https://www.lanqiao.cn/oj-contest/newbie-24/ 1. 分配辣条 签到题。 #include <iostream> using namespace std; int main() { cout<<20250601/305*305; return 0; } Vi 阅读全文
posted @ 2024-12-15 12:52 greenofyu 阅读(14) 评论(0) 推荐(0)

2024年11月13日

摘要: 1 class Solution { 2 public: 3 vector<long long> countKConstraintSubstrings(string s, int k, vector<vector<int>>& queries) { 4 int n = s.size(); 5 vec 阅读全文
posted @ 2024-11-13 10:36 greenofyu 阅读(33) 评论(0) 推荐(0)

2024年11月12日

摘要: 数据范围小,直接暴力枚举所有子字符串,统计每个子字符串的0和1的数量就行了。 1 class Solution { 2 public: 3 int countKConstraintSubstrings(string s, int k) { 4 int res=0; 5 for(int i=0;i<s 阅读全文
posted @ 2024-11-12 10:29 greenofyu 阅读(26) 评论(0) 推荐(0)

2024年11月11日

摘要: 1 class Solution { 2 public: 3 int minCost(int n, vector<int>& cuts) { 4 int m = cuts.size(); 5 sort(cuts.begin(), cuts.end()); 6 cuts.insert(cuts.beg 阅读全文
posted @ 2024-11-11 10:18 greenofyu 阅读(21) 评论(0) 推荐(0)

2024年11月10日

摘要: 要求O(logn)的复杂度基本就是二分。 分析序列1,1,2,2,3,4,4,5,5 (0,1),(2,3),(5,6),(7,8)各自成对。 0,1 10,11 101,110 111,1000 可以观察出目标的左边可用^异或找出成对的,右边则不行,所以可以据此来二分。 1 class Solut 阅读全文
posted @ 2024-11-10 11:54 greenofyu 阅读(19) 评论(0) 推荐(0)

2024年11月9日

摘要: 模拟题,需要找到之后需要判定一下边界,别越界了。 1 class NeighborSum { 2 private: 3 int n; 4 vector<vector<int>> grid; 5 vector<vector<int>> adj={{-1,0},{0,1},{1,0},{0,-1}}; 阅读全文
posted @ 2024-11-09 19:46 greenofyu 阅读(11) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 22 下一页