weinan030416

导航

2023年2月13日 #

第几小

摘要: #include <iostream> #include <vector> #include <cmath> #include <algorithm> using namespace std; int main() { // 请在此输入您的代码 int n; cin>>n; //块长 int len 阅读全文

posted @ 2023-02-13 21:07 楠030416 阅读(21) 评论(0) 推荐(0) 编辑

最大和

摘要: 错误 #include<bits/stdc++.h> using namespace std; const int N = 1e6; int isprime[1000005] = {}; int d(int t)//最小质因数 { for (int i = 1; i <= N; i++)//最大就是 阅读全文

posted @ 2023-02-13 20:51 楠030416 阅读(22) 评论(0) 推荐(0) 编辑

哈希表

摘要: class Solution { public: vector<int> intersect(vector<int>& nums1, vector<int>& nums2) { if (nums1.size() > nums2.size()) { return intersect(nums2, nu 阅读全文

posted @ 2023-02-13 14:45 楠030416 阅读(2) 评论(0) 推荐(0) 编辑

第一个不重复的字符

摘要: 循环超时 class Solution { public: int firstUniqChar(string s) { for(int i=0;i<s.size();i++) { bool ok=true; for(int j=0;j<s.size();j++) { if(j==i) continu 阅读全文

posted @ 2023-02-13 14:05 楠030416 阅读(9) 评论(0) 推荐(0) 编辑

dp

摘要: 121. 买卖股票的最佳时机 - 力扣(LeetCode) class Solution { public: int maxProfit(vector<int>& prices) { int max=0; for(int i=0;i<prices.size();i++) for(int j=i;j< 阅读全文

posted @ 2023-02-13 13:36 楠030416 阅读(19) 评论(0) 推荐(0) 编辑

排列问题

摘要: 有n个人排成一队散步,第二天a56爆大奖在线娱乐人都不想和前一天前面的人相同,多少种排列 n!-(n-1)(n-1)!+(n-2)(n-2)!-...1*1 模拟n=3 #include<iostream> #include<algorithm> #include<string.h> using namespace 阅读全文

posted @ 2023-02-13 12:16 楠030416 阅读(21) 评论(0) 推荐(0) 编辑

多源bfs

摘要: 输入 第一行两个整数n,m。 接下来一个N行M列的01矩阵,数字之间没有空格。 数据范围 1≤N,M≤1000 输出 一个N行M列的矩阵B,相邻两个整数之间用一个空格隔开。a56爆大奖在线娱乐整数a56爆大奖在线娱乐加农势力存在的毫秒数(最小曼哈顿距离值) 输入样例 1 3 4 0001 0011 0110 输出样例 1 3 2 阅读全文

posted @ 2023-02-13 10:02 楠030416 阅读(22) 评论(0) 推荐(0) 编辑