自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

爱敲代码的小鼠的博客

多一些不为什么的坚持。。

  • 博客(128)
  • 收藏
  • 关注

原创 C++使用std::chrono来计算代码段所花费的时间

【代码】C++使用std::chrono来计算代码段所花费的时间。

2024-02-22 09:40:12 360

原创 【无标题】

通过WebRTC进行音视频设备 我们可以直接通过调用WebRTC API来获取音视频设备,其中包含: MediaDevice : 该接口提供了访问计算机上的媒体设备,比如摄像头、麦克风、截取屏幕的方法等。 MediaDeviceInfo : 它表示每个输入\输出设备的信息,包含以下三个重要的属性: deviceID,设备的唯一标识 label, 设备名称 kind, 设备种类,可用于识别是音频设备还是视频设备,是输入设备还是输出设备 获取音视频设备的接口 MediaDevice.enumrateDevi

2021-12-29 19:35:54 2048

原创 WebRTC之用浏览器访问摄像头

WebRTC 处理过程 这幅图大致分为三个部分: WebRTC终端:负责音视频采集、编解码、NAT穿越、音视频数据传输。 Signal服务器:负责信令处理,如加入房间、离开房间、媒体协商消息的传递等。 STUN/TURN服务器:负责获取WebRTC终端在公网的ip地址,以及NAT数据穿越失败后的数据中转。 音视频采集的基本概念: 摄像头 帧率:摄像头一秒采集图像的次数 分辨率:图像的像素个数 宽高比 麦克风 采样率:麦克风一秒内采样的次数 轨:MP4中分为音频轨和视频轨,相互独立 流:可以理解为容器

2021-12-28 20:29:29 1900

原创 网易2020校招笔试- 系统开发/研发工程师(提前批)算法题题解

13 小易的英语软件 题面 思路 发现分数最大值是150, 题目要求每次找不超过分数x的人数,需要找10000次。 考虑暴力解法 每次找不超过分数x的人数,都遍历一次数组,需要遍历10000次,肯定超时 优化 优化可以优先考虑空间换时间, 所以可以用map存每个分数的人数,然后遍历分数就可以了,最多只需要遍历150次 代码 #include <bits/stdc++.h> using namespace std; const int N = 10010, M = 160; int a[N]

2020-07-30 16:33:03 564

原创 大端-小端相关知识总结

概念 数据的低字节存放在内存的低地址处,称为小端模式 数据的低字节存放在内存的高地址处,称为大端模式 cpu读取数据的顺序是从低字节向高字节进行的。比如 int i = 0x12345678 从左向右依次为数据的高字节 -> 低字节 检测方法,按照定义来 void func1() { union W{ int i; char ch; }w; w.i = 1; if (w.ch == 1) { puts("little

2020-07-27 11:41:50 259

原创 牛客编程巅峰赛S1第6场 - 黄金&钻石&王者题解

牛牛爱奇数 链接:https://ac.nowcoder.com/acm/contest/6629/A 来源:牛客网 题目描述 在牛牛面前放着n个数,这些数字既有奇数也有偶数,只不过牛牛对奇数情有独钟,他特别想让这些数都变成奇数。 现在牛牛获得了一种能力,他可以执行一种操作:每次选中一个偶数,然后把这些数中与该数相等的数都除以2,例如现在有一个数组为[2,2,3][2,2,3],那么牛牛可以执行一次操作,使得这个数组变为[1,1,3][1,1,3]。 牛牛现在想知道,对于任意的n个数,他最少需要操作多少

2020-07-27 10:29:51 737 1

原创 牛客编程巅峰赛S1第4场 - 黄金&钻石题解

A 牛牛分蛋糕 思路:最小化最大值用二分+贪心时间复杂度O(logn) class Solution { public: /** * 处理函数,返回在所有分法中,蛋糕数量最少的盘子中分到最多的蛋糕数量 * @param n int整型 n个盘子 * @param a int整型 a蛋糕数量 * @param b int整型 b蛋糕数量 * @return int整型 */ int solve(int n, int a, int b)

2020-07-18 23:09:37 269

原创 c++ primer练习题答案

第九章课后习题部分答案 《顺序容器》 练习9.5 #include <vector> using namespace std; typedef vector<int>::const_iterator it; bool find(it first, it last, const int val) { while (first != last && *first != val) { ++first; } return first

2020-07-17 10:30:53 1242

转载 【牛客 错题集】Linux系统方面错题合集(转载)

原文链接:https://www.cnblogs.com/hehehe886/p/7502451.html

2019-12-05 10:16:22 257

原创 我是一个小菜鸡,从来也不放弃努力

Rational Sum (20) 时间限制 1000 ms 内存限制 65536 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 Given N rational numbers in the form "numerator/denominator", you are supposed to calculate their sum. 输入描述: Each...

2018-09-23 20:23:11 551

原创 类似最小生成树

题目 链接:https://www.nowcoder.com/acm/contest/188/C 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 小w不会离散数学,所以她van的图论游戏是送分的 小w有一张n个点n-1条边的无向联通图,每个点编号为1~n,每条边都有一个长...

2018-09-22 20:39:02 363

原创 2018/09/14最长公共子序列问题

#include &lt;bits/stdc++.h&gt; using namespace std; string a,b; int d[100][100]; int main() { cin &gt;&gt; a &gt;&gt; b; int lena = a.length(); int lenb = b.length(); d[0][0] = a[...

2018-09-14 08:57:08 233

原创 2018/09/13 kruskal算法并查集

空间压缩前算法版本 /* 第一次接触并查集是在紫书上的kruskal上学的。当时作者对边排序的时候用的是,间接排序,很懵,看不懂啊。于是根据自己以往的学习,此处只需要知道最小边的原始边号。因此我可以用结构体啊。 #include &lt;bits/stdc++.h&gt; using namespace std; const int maxn = 100; struct Node { ...

2018-09-13 14:43:18 463

原创 .Kruskal算法 优先队列+并查集,用优先队列代替排序。

代码 /* 思路,将边集加入到最小优先队列,每次取出一个最小边,如果边的两个端点有一个没有访问过,说明加入这条边,就没有构成环。可以加入。 突然发现这个思路是错的。判断是不是环,我的说法是错误的。还没有想到解决办法。 如果解决了:加入一条边,能够判断是否形成环。能把这点实现,并优化就可以了。 */ #include&amp;lt;bits/stdc++.h&amp;gt; using namesp...

2018-09-12 22:15:51 990

原创 2018/9/12 学习研究prim时间复杂度o(nlogn)

prim算法 /* O(n^2)解法 */ #include&lt;bits/stdc++.h&gt; using namespace std; const int maxn = 100; int p[maxn][maxn]; int vis[maxn]; int d[maxn];//d[i]表示终点为i的最短距离 int n,m; int ans; void prim() { ...

2018-09-12 21:43:27 5221

原创 2018/09/11 上午之set.map简单学习

/* 这里介绍RB-TREE实现的set,由于RB-TREE是平衡二叉搜索树,所以set具有自动排序的功能。 stl的1.find()函数与set关联容器自带的2.find()的使用方法及比较。 2比1优 set&lt;int&gt; iset; set&lt;int&gt;::iterator it; 1.stl之find 循环比较实现,O(n) it = find(iset.be...

2018-09-11 11:32:07 234

原创 每天一学习,记录一下

原题 链接:https://www.nowcoder.com/acm/contest/35/A 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 给出n个整数和x,请问这n个整数中是否存在三个数a,b,c使得ax2+bx+c=0,数字可以重复使用。 输入描述:...

2018-09-11 10:30:49 409

原创 pat练手

1001 A+B Format(20 分) Calculate a+b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits). Input Spe...

2018-09-03 13:46:33 287

原创 uva10988(静态链表)

样例 Sample Input This_is_a_[Beiju]_text [[]][][]Happy_Birthday_to_Tsinghua_University Sample Output BeijuThis_is_a__text Happy_Birthday_to_Tsinghua_University /* 题意分析:将[]中的内容整体移动最左边 1.考虑用数组。...

2018-09-03 11:40:31 289

原创 2017/8/8学习小结

Score1585:https://vjudge.net/problem/UVA-1585 analysis 用一个标记变量symbol判断是否连续即可code#include<iostream> #include<cstring> using namespace std; #define maxn 85 char str[maxn];int main() { int n,score;

2017-08-08 23:13:43 388

原创 Circular Sequence--1584

issue descriptionlink:https://vjudge.net/problem/UVA-1584 description: Some DNA sequences exist in circular forms as in the following figure, 一些DNA序列具有像如图所示的环形形式, which shows a circular sequenc

2017-08-06 23:30:22 442

原创 Master-Mind Hints --340

problem descriptionlink:https://vjudge.net/problem/UVA-340description: MasterMind is a game for two players. One of them, Designer, selects a secret(秘密的) code. The other, Breaker, tries to break it.

2017-08-05 23:21:33 474

原创 Palindromes--uva401

problem linkhttps://vjudge.net/problem/UVA-401analysis这道题的技巧很好,很喜欢,感觉能学到蛮多东西code#include<cstdio> #include<cstring> #include<cctype> const char* rev = "A 3 HIL JM O 2TUVWXY51SE Z 8 "; const char*

2017-08-05 12:32:12 420

转载 50道hdu基础搜索总结(转)

原文链接:http://www.cnblogs.com/kiwi-bird/archive/2012/11/24/2785247.htmlDfs:大部分是直接递归枚举,即求满足约束条件下的解,虽不用剪枝,但也需要代码能力。练习递归枚举的题目:1241 Oil Deposits (dfs的连通块个数)1016 Prime Ring Problem1584 蜘蛛牌(简

2017-08-01 13:16:16 424

原创 1627--Krypton Factor

Problem DescriptionYou have been employed by the organisers of a Super Krypton Factor Contest in which contestants have very high mental and physical abilities. In one section of the contest the contes

2017-07-29 19:57:35 497

原创 1172--猜数字

原题链接http://acm.hdu.edu.cn/showproblem.php?pid=1172 Sample Input 6 4815 2 1 5716 1 0 7842 1 0 4901 0 0 8585 3 3 8555 3 2 2 4815 0 0 2999 3 3 0Sample Output 3585 Not sureproblem of processi

2017-07-28 21:33:40 697

原创 1045--Fire Net

原题链接http://acm.hdu.edu.cn/showproblem.php?pid=1045Sample Input 4 .X.. …. XX.. …. 2 XX .X 3 .X. X.X .X. 3 … .XX .XX 4 …. …. …. …. 0Sample Output 5 1 5 2 4解题思路首先这个是八皇后的高级变形问题。

2017-07-25 19:35:45 353

原创 1035--Robot Motion

题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1035Sample Input 3 6 5 NEESWE WWWESS SNWWWW 4 5 1 SESWE EESNW NWEEN EWSEN 0 0 Sample Output 10 step(s) to exit 3 step(s) before a loop of 8 ste

2017-07-23 16:52:39 485

原创 1241-Oil Deposits

原题链接http://acm.hdu.edu.cn/showproblem.php?pid=1241Sample Input 1 1 * 3 5 @@* @ @@* 1 8 @@**@* 5 5 **@ @@@ @*@ @@@*@ @@**@ 0 0 Sample Output 0 1 2 2解题思路/* 本题就是一个简单的求图里面连通块的问题。 简单的dfs

2017-07-22 23:03:57 335

原创 1016-Prime Ring Problem

题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1016Sample Input 6 8Sample Output Case 1: 1 4 3 2 5 6 1 6 5 2 3 4Case 2: 1 2 3 8 5 6 7 4 1 2 5 8 3 4 7 6 1 4 7 6 5 8 3 2 1 6 7 4 3 8 5 2解题思想/* 本题由

2017-07-16 23:33:28 307

原创 1010-Tempter of the Bone

题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1010Sample Input 4 4 5 S.X. ..X. ..XD …. 3 4 5 S.X. ..X. …D 0 0 0Sample Output NO YES解题思想/* dfs+奇偶性剪枝 奇偶性剪枝:假设起点为s,终点为e,并且起点到终点的最短路径为dis = e-s,

2017-07-15 12:35:43 398

原创 自我反思

/* 今天我向一个蛮厉害的cf网友请教关于数位dp怎么学的问题,他很不嫌烦的对我回答了许多。告诉我数位dp蛮难的,用到的地方不是太多,让我先刷一些基础题。 首先说一下自己的问题,最近虽然在备战考研,但是还是每天在51nod上刷一题,一直在坚持。 但是一直觉得自己没有进步,比赛的时候看到题目还是没有什么思路,自己也特别烦, 然后他就对我说了,这个东西好好学习个三年(不好听就是坚持三年),你就

2017-07-13 23:42:15 365

原创 1242 斐波那契数列的第N项

题目1242 斐波那契数列的第N项 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 斐波那契数列的定义如下:F(0) = 0 F(1) = 1 F(n) = F(n - 1) + F(n - 2) (n >= 2)(1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, …) 给出n,求F(n),

2017-07-13 00:36:19 544

原创 线性表的顺序存储

代码#include<iostream> using namespace std; #define MaxSize 50 //定义线性表的最大长度 typedef int ElemType; /* 假定线性表的元素类型是ElemType 此处为线性表的顺序存储,即用数组 */ typedef struct { ElemType data[MaxSize]; //顺序表的元素 int

2017-07-09 12:38:22 355

原创 1174 区间中最大的数

题目解题思想/* rmq(动态规划思想) */代码#include<iostream> #include<math.h> using namespace std; int m[10005][20]; int n; //初始化 void work() { for(int j=1; 1<<j<=n; ++j) for(int i=1; i+(1<<j)-1<=n; ++i)

2017-07-09 00:17:32 344

原创 1181 质数中的质数(质数筛法)

题目解题思想很简单一道题,质数打表代码#include<iostream> #include<string.h> #include<math.h> using namespace std; const int maxn = 1e6+5; int vis[maxn]; int a[maxn]; void init() { memset(vis,0,sizeof(vis)); } bool is

2017-07-08 19:01:50 479

原创 1106 质数检测

题目解题思路1.直接暴力 2.打表代码/* 方法一:打表,虽然思路是对的,但此题不行,应为 数据可能为1e9,数组开太大,会爆 */ #include<iostream> #include<math.h> #include<string> using namespace std; const int maxnu = 1e9+5; const int maxn = 1005; int n ; int

2017-07-08 13:25:41 386

原创 梦想

少一些功利主义的追求,多一些不为什么的坚持。 虽然自己在备战考研,但是自己这几天没刷题,感觉好空虚啊,自己想着,还是每天51nod上面刷一道题吧。就像上面所说的,多一些不为什么的坚持。 Don't aim for success if you really want it. Just stick to what you love and believe in,and it will com

2017-07-08 00:08:53 386

原创 1014 X^2 Mod P

题目解题思路/* 因为数据量是1e6,所以O(n)时间复杂度可以解决 */代码#include<iostream> #include<stdio.h> using namespace std; typedef long long ll; int main() { int A,P; scanf("%d%d",&P,&A); ll sum; bool flag = fal

2017-07-08 00:01:37 557

原创 数据流中的算法

题目数据流中的算法 Wizmann (命题人) 基准时间限制:1.5 秒 空间限制:131072 KB 分值: 20 51nod近日上线了用户满意度检测工具,使用高级人工智能算法,通过用户访问时间、鼠标轨迹等特征计算用户对于网站的满意程度。现有的统计工具只能统计某一个窗口中,用户的满意程度的均值。夹克老爷想让你为统计工具添加一个新feature,即在统计均值的同时,计算窗口中满意程度的标准差和

2017-06-25 22:12:42 583

空空如也

空空如也

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

TA关注的人

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