自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 Unity实现长按重攻击短按轻攻击

【代码】Unity实现长按重攻击短按轻攻击。

2023-08-17 04:08:14 183 1

原创 安卓富文本编辑器

自动解析超链接和表情。但写得不是很满意,仅供参考。public class RichCharSequenceBuilder { private CharSequence charSequence; private final static String EMPTY_STR = ""; private final static String HYPERLINK_COLOR = "#5CA2AE"; public RichCharSequenceBuilder() {

2021-11-23 14:49:02 1772

原创 可展开收缩的仿今日头条浮窗播放器

不包含音乐播放代码。主要目的是其中的展开和收缩逻辑。浮窗部分继承自FloatingMagnetView主要逻辑public class FloatingMusicPlayerView extends FloatingMagnetView { private int expandWidth = 0; private boolean isExpand = false; private boolean isLeftSide = true; private ImageVi

2021-11-23 14:45:01 232 1

原创 PopupWindow及ItemTouchHelper用例

可以设置长按以移动内部标签,标签可以流畅运动且不会超出上下边界。部分代码需要替换。public class PageManagePopupWindow extends PopupWindow { private Context context; private List<PageInfo> fixedData = new ArrayList<>(); private List<PageInfo> mutableData = new Arra

2021-11-23 14:35:37 213

原创 git简单使用

git简单使用1.拉取远程分支git pullgit checkout -b "本地分支名" origin/"远程分支名"2.提交git pullgit add *git commit -m "提交名"git push3.合并分支先本地更新希望合并入的分支,后跳转至对应分支并使用git merge "希望合并入分支名"...

2021-11-09 10:46:49 56

原创 三次握手及四次挥手

https://www.cnblogs.com/onesea/p/13053697.htmlhttps://www.zhihu.com/question/271701044/answer/1279809269https://baijiahao.baidu.com/s?id=1654225744653405133&wfr=spider&for=pc

2021-05-09 13:10:20 45

原创 四线程四文件问题

看到有一道多线程小题。题目大意为四个线程分别向四个文件中打印1234。需要符合格式:A:1 2 3 4 1 2…B:2 3 4 1 2 3…C:3 4 1 2 3 4…D:4 1 2 3 4 1…#include <bits/stdc++.h>#include <thread>#include <mutex>#include <condition_variable>using namespace std;int flag=1;int

2021-05-05 15:48:38 78 1

原创 多线程面试题总结

做些总结。1.关于线程:线程是操作系统运行调度的基本单位。线程被包含在进程之中,是进程中的实际运作单位。2.关于进程:进程是操作系统资源分配的基本单位。进程是指在系统中正在运行的一个应用程序。进程是一个实体,每一个进程都有其独有的地址空间。...

2021-05-02 22:56:28 69

原创 多线程查找

u1s1,其实这段代码中的task()是有一点小问题的。#include <thread>#include <atomic>#include <bits/stdc++.h>using namespace std;template<typename Iter>void task(Iter start,Iter end,int goal,atomic<bool>& f) { for(;start!=end&&amp

2021-04-26 10:54:03 93

原创 多线程实现for_each

代码是书上的,加了注释,有一点改动。#include <thread>#include <bits/stdc++.h>template<typename Iterator,typename Func>void parallel_for_each(Iterator first,Iterator last,Func f){ //确定first与last间元素个数 unsigned long const length=std::distance(fi

2021-04-25 21:55:59 312

原创 线程池的实现

这个线程池比较初级,只能根据情况添加线程,无法删除线程。#include <bits/stdc++.h>//#include <pthread.h>#include <thread>#include <mutex>#include <condition_variable>#include <atomic>using namespace std;typedef void (*func)(void* arg);stru

2021-04-21 21:29:35 36

原创 对于生产者和消费者模型的一些总结

生产者和消费者模型在大体上结构如下//一段很伪的伪代码mutex m; //这是锁condition_variable cond; //这是条件变量int num; //这是当前产品数//以下是生产者函数m.lock(); //加锁produce(); //生产m.unlock(); //解锁m.notify_all(); //通知一下资本家可以吸血了//以下是消费者函数m.lock();while(num==0) { //判断当前产品数是否为0 cond.wait(m);

2021-04-18 23:45:43 136

原创 查找所有的最长公共子序列

#include <bits/stdc++.h>using namespace std;void sol(string x,string y) { int l1=x.size(); int l2=y.size(); vector<vector<int>> bag(l1+1,vector<int> (l2+1,0)); for(int i=1;i<=l1;i+=1) { for(int j=1;j&lt

2021-04-04 17:42:48 188

原创 查找字符串中的最长回文及对字符串进行最少次数的回文划分

#include <bits/stdc++.h>using namespace std;void sol(string s) { int len=s.size(); int start=0;//最长回文的起始位置 int res=1;//最长回文的长度 vector<vector<int>> bag(len,vector<int> (len,0));//动态规划表 //在此动态规划表中,若字符串第i位置至第j位置为

2021-04-04 12:39:16 59

空空如也

空空如也

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

TA关注的人

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