自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(7)
  • 资源 (2)
  • 收藏
  • 关注

原创 string的find函数返回值和string::npos

先看一种很多人日常使用错误方式string str(“hello world”);int pos=str.find_first_of(“h”);if(pos!=string::npos) // 或者 if(pos!=-1){……// 查找到了} //不存在是find返回-1这样的使用,结果是正常的,但并没有很好的理解string find函数的返回类型和string::npos真正的值。string::find这类型的函数,返回值类型都是string::size_type, 而string

2020-08-11 16:30:21 1995

原创 0808面试

这次猿辅导的面试很糟糕,代码写的很差。这题就是奇偶链表了。#include<iostream>#include<vector>using namespace std;typedef struct ListNode{ int val; ListNode*next; ListNode(int val) :val(val), next(NULL) {}}ListNode;ListNode*fun(ListNode*head){ if (head->nex

2020-08-09 09:59:39 232

原创 安排机器——18TX

我的思路是先对任务排序(按工作时长优先,降序排列)然后对于每个任务(贪心,先选工作时间最长的任务),把时间满足要求且等级满足要求的机器全挑出来,再从中选出等级最低的那一台。#include<iostream>#include<vector>#include<algorithm>using namespace std;const int maxn = 1e5 + 10;struct node { int time, grade; bool isUsed .

2020-08-05 20:26:04 221

原创 huawei练习卷2

这份卷子很简单,三道题全部AC#include<iostream>using namespace std;int main() { int n; while (cin >> n) { if (n == 0) break; //正常的解法 int res = 0; int a, b; while (n >= 3) { a = n / 3;//换的新瓶 b = n % 3;//剩的空瓶 res += a; n = a + b

2020-08-05 15:27:16 178

原创 2016hw卷练习

小结:除了数独这道题写的出了bug,交卷才发现并改正,剩下两题都很轻松。#include<iostream>#include<vector>using namespace std;bool rows[9][10] = { false };//rows[i][j]为true表示第i行的数字j已经被使用了bool cols[9][10] = { false };//cols[i][j]为true表示第i列的数字j已经被使用了bool blocks[9][10] = { fa

2020-08-05 14:28:32 201

原创 pdd笔试题

拼多多的笔试没有报名,但昨天听伙伴们说很难,所以一共4道题,挑了2道会的,自己编了一下。#include<iostream>#include<vector>#include<algorithm>using namespace std;int main(){ int K, N; cin >> K; cin >> N; vector<int>a(N); for (int i = 0; i < N; i++)

2020-08-03 10:21:10 1180

原创 0801笔试

求最大的重叠区间个数#include<iostream>#include<vector>#include<algorithm>using namespace std;class Node{public: int value; int flag; Node(int value, int flag) :value(value), flag(flag) {} bool operator<(const Node&node) { if ..

2020-08-01 21:42:31 250

java基础 综合项目代码

java基础 综合项目

2020-12-21

epoll反应堆.zip

epoll反应堆.zip

2020-06-25

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除