自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(37)
  • 资源 (4)
  • 收藏
  • 关注

原创 leetcode 64. 最小路径和

题目地址:https://leetcode-cn.com/problems/minimum-path-sum/题目简介:给定一个包含非负整数的mxn网格grid,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。说明:每次只能向下或者向右移动一步。题目解:class Solution { public int minPathSum(int[][] grid) { if(grid == null || grid.length ...

2020-12-01 14:40:19 85

原创 2020-08-22

Leetcode 648 单词替换地址:https://leetcode-cn.com/problems/replace-words/代码:/** * @Author linchen.wcy */class Solution { class TreeNode { char data; List<TreeNode> child; TreeNode parent; boolean isWord; ..

2020-08-22 22:44:26 306

原创 Leetcode82 Remove Duplicates from Sorted List II

题目链接:Remove Duplicates from Sorted List II题目简介:1-2-3-3-4-4-5 返回 1-2-51-1-2-3 返回 2-3题目解答:/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) {.

2020-07-27 12:26:58 128

原创 TreeMap排序记录

记录一下TreeMap对数据的排序,有点像桶排public static void mysort(int[] nums) { TreeMap&lt;Integer,Integer&gt;data = new TreeMap&lt;&gt;(); for(int i=0;i&lt;nums.length;i++) data.put...

2018-10-09 21:16:58 271

原创 Dubbo入门案例

由于比赛,需要用到dubbo,因此花了点时间熟悉一下。写一个简单的案例,捋一捋流程。主要分为服务端、客户端。一、服务定义也即是接口的定义,参照官网给出的用例。定义如下接口:package com.alibaba.dubbo.demo;public interface DemoService { String sayHello(String name);}其中,客户端只需要有这个接口的...

2018-04-27 21:08:58 153

原创 IDEA SpringMVC Mock测试出现问题解决

IDEA MockMvc 测试时出现。Caused by: java.util.MissingResourceException: Can't find bundle for base name javax.servlet.LocalStrings, locale zh_CN选择项目的project structure,在libraries中引入 servlet容器(如tomcat)的jar包即可...

2018-04-24 12:48:18 945

转载 tomcat启动报异常: java.util.zip.ZipException: invalid LOC header (bad signature)

转载自    https://blog.csdn.net/limingjian/article/details/53925001原因是jar包下载缺损。到maven的reposity目录下搜aether*****in-progress(可以搜aether或者in-progress都行)文件,如果存在,把这个文件对应的版本目录删除,刷新一下项目重新部署打包即可...

2018-04-19 21:35:53 1500

原创 MongoDB解决外网访问问题

mongodb version:3.6.3网上能找到的各个教程、基本都是localhost,没任何参考价值。最后自己找帮助文档找到了,启动的时候加上参数 --bind_ip_all。启动命令类似这样:mongod --dbpath ./db --bind_ip_all...

2018-04-16 21:52:03 10720 2

转载 Hadoop 经典案例:词频统计

全文作为个人记录用。不做任何参考。环境搭建参考:http://www.ityouknow.com/hadoop/2017/07/24/hadoop-cluster-setup.html词频代码参考:https://blog.csdn.net/a60782885/article/details/713082561、环境搭建总共选择了3台虚拟机作为本次的主角master:192.168.21.130s...

2018-04-07 14:09:15 14414

原创 LeetCode Jump Game

https://leetcode.com/problems/jump-game/description/class Solution {public: bool canJump(vector&lt;int&gt;&amp; nums) { if(nums.size()==1)return true; int cur=nums.size()-1; for(int ...

2018-03-13 16:49:47 98

原创 LeetCode题解 39. Combination Sum

仅仅用作自己练习的记录用。题目地址:https://leetcode.com/problems/combination-sum/description/大意就是说给你一串数字,从里面挑选(可重复)数字进行组合,数字之和为一个给定的数class Solution { public: vector&lt;vector&lt;int&gt; &gt;ve; vector&lt;...

2018-03-09 20:48:29 113

原创 Java静态导入

形式 :import  static  包名.类名.成员(field,method)用途:直接导入类中的静态变量,静态常量,静态方法。而不用使用类名.*;例如package cn;public class util{ public static void println(String args){ System.out.println(args);}

2017-12-13 20:03:01 168

原创 HDUOJ 1061 Rightmost Digit

Rightmost DigitTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 60847    Accepted Submission(s): 22845Problem DescriptionGiven a

2017-12-07 15:16:50 278

原创 快速幂的算法理解

一直听说过快速幂,一直没有用过。这下稍微有了点空闲时间,做个笔记自己看看。。求一个数的n次幂常见的是n次循环。例如。 double Power(double base,int exponent){ bool flag=false; double total=1; if(exponent<0){ flag=true; exponent=-exponent;

2017-12-06 21:00:50 493

原创 n&n-1发生了什么

做oj遇到一道题,求二进制中1的个数。发现有大佬用来(n&n-1)。觉得很神奇。有空下来细想。确实是这么个道理。记录一下自己的分析过程一、n-1发生了什么①、二进制数n,n-1后,如果最后一位是0,将向前一位借2,2-1=1。最后一位为1。如果前一位为0,将继续向前一位借2,加上本身少掉的1.则变为1。一直遇到1。减为0.所以 二进制  xxxx10000-1 = xxxx01111

2017-12-06 20:15:17 9671 3

原创 Maven下SpringMVC简单例子

正在看beginning Spring一书,其中给出了一个简单的SpringMVC例子。作为初学者,这是很好的练手小玩具。记录一下实验过程。步骤一Eclipse新建maven项目,选择webapp。具体见下图                            步骤二引入Spring依赖,在pom.x

2017-06-15 21:13:15 319

转载 Python中文乱码问题

学Python遇到的最大问题就是编码了。。。网上看了点解决方法,记录一下。1、头部加上#coding:utf-8import sysreload(sys)sys.setdefaultencoding('utf-8')2、爬虫遇到乱码先看看网站的编码是啥。。控制台即可查看:        用了requests在访问text之前,调用response

2017-03-18 20:24:14 232

原创 C++ 11 匿名函数体验

匿名函数用起来确实风骚~#include#include#include#include#includeusing namespace std;int main(){ vectorve; srand(time(0)); for(int i=0;i<1000;i++) ve.push_back(rand()%10); copy(ve.begin(), ve.

2017-03-15 21:27:07 563

原创 BUPT OJ 丁神又去谷歌

/*USER_ID: test#bupt_wcyPROBLEM: 417SUBMISSION_TIME: 2017-03-10 12:05:45*/#include#include#define MAXSIZE 10002using namespace std;// DPint n;int a[MAXSIZE];long long b[MAXSIZE];// f[i][j

2017-03-10 12:11:20 467

原创 单调递增最长子序列

南阳理工oj数据比较弱。。。#include#include#define MAX_SIZE 10002using namespace std;char str[MAX_SIZE];int cost[MAX_SIZE];int main(){ int t; int len; cin>>t; char c; while(t--) { cin>>str;

2017-03-06 23:06:44 272

原创 一笔画问题(南阳理工oj)

#include#includeusing namespace std;int a[1001];int fa[1001];int find(int i){ while(i!=fa[i]) i=fa[i]; return i;}void join(int i,int j){ int fa_i=find(i); int fa_j=find(j); if(fa_i!=

2017-03-05 20:54:04 667

原创 记录一次爬虫经历

初学python,先记录一次爬虫经历,就作为python的入门训练吧。目标网站采用了动态加载技术。#-*- coding:utf-8 -*-import requestsimport reimport threadingglobal headers_for_pc,headers_for_realurl,offset_for_pc,forbiddenoffset_for_pc=0fo

2017-02-07 16:25:49 433

原创 BUPT OJ 非平方等式

纯粹数学题。如果无脑直接枚举肯定超时。所以我就超时了。。。后来分析了一下。x^2+s(x)*x-n=0,能拆开成 x*(x+s(x))=n的形式,由于n小于10^18次方,x最大s(x)=162,所以能够得到不等式  sqrt(n)-162剩下的就没啥了/*USER_ID: test#bupt_wcyPROBLEM: 130SUBMISSION_TIME: 2017-01

2017-01-26 21:18:18 755

原创 BUPT OJ 中序遍历树

水题。开始看错,当成按照每个节点代表的字符顺序访问了,后来改完就可以了。#include#include#includeusing namespace std;char func[101];bool relation[100][100]={false};bool visited[100]={false};string result;string temp;void dfs

2017-01-24 15:43:01 861

原创 BUPT OJ 虚数

#include#include#include#includeusing namespace std;class complex{ public: int real; int image; complex(int a=0,int b=0) { real=a; image=b; } };class cmp{ public: bool operator()(

2017-01-23 18:29:37 425

原创 BUPT OJ 寻找宝藏

水题#include#includeusing namespace std;class node{public: int parent; int branches; node() { branches=0; parent=-1; }};const int MAXSIZE = 10000;class tree{public: node point[MAXSIZ

2017-01-23 14:48:16 387

原创 BUPT OJ IP地址

水题#include#includeusing namespace std;inline bool ipstring(string ip){int threes=0;for(int i=0;i{if(ip[i]=='.')threes++;} return threes==3&&ip[ip.size()-1]!='.'&&ip[0]!='.';

2017-01-18 16:12:50 862

原创 BUPT OJ 矩阵幂

水题#include#include#define MAXSIZE 10using namespace std;int k;class matrix{ public: int n; int metric[MAXSIZE][MAXSIZE]; friend ostream& operator<<(ostream&out,matrix &a); friend istream&

2017-01-15 12:36:13 289

原创 BUPT OJ 最小距离查询

用了类似邻接表的结构,一个vector,存放每种字母对应的出现位置,并在插入时排序。用cin超时,scanf通过。。。 怪不得连题目描述里#include#include#include#include#include#include#define MAXSIZE 100001using namespace std;class node{ public:

2017-01-14 23:06:13 367

原创 BUPT OJ 中序遍历序列

水#include#include#includeusing namespace std;int main(){ int t,n,x; cin>>t; while(t--) { vectorBeforeSort; vectorAfterSort; cin>>n; while(n--) { cin>>x; BeforeSor

2017-01-14 16:28:01 330

原创 BUPT OJ 统计节点个数

#include#define MAXSIZE 1000using namespace std;class node{ public: int degree; int parent; int numOfSon; int son[1000]; node() { degree=0; parent=0; numOfSon=0; }};class

2017-01-14 16:10:14 325

原创 BUPT OJ 文件系统

孩子兄弟表示法的多叉树遍历 #include#includeusing namespace std;enum type{file,dir};class node{public: string name; type mytype; node*child; node*brother;//孩子兄弟表示法; };void CreateFile(node*pt,string f

2017-01-13 17:28:29 1117

原创 二叉排序树

题目1467:二叉排序树时间限制:1 秒内存限制:128 兆特殊判题:否提交:3883解决:1566题目描述:        二叉排序树,也称为二叉查找树。可以是一颗空树,也可以是一颗具有如下特性的非空二叉树:        1. 若左子树非空,则左子树上所有节点关键字值均不大于根节点的关键字值;

2016-08-02 23:00:22 679

原创 Trie树

博客贴代码老出错也是醉了。。。#includeusing namespace std;struct node{ struct node*child[26]; int t; bool exist; node() { t=0; for(int i=0;i<26;i++) { child[i]=NULL; //path[i]='\0'; } }};

2016-07-14 21:51:32 206

原创 单链表的反转

反转链表/*struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { }};*/class Solution {public: ListNode* ReverseList(ListNode* pHead) {

2015-12-21 14:29:42 350

转载 栈的最小值

今天刷题看到了一个求栈最小值的方法,觉得很不错啊~~class Solution {public: stack >s; void push(int value) { if(s.empty())s.push(pair(value,value)); else if(value(value,value));

2015-12-20 11:10:39 378

原创 NowCoder猜想--牛客网题

NowCoder猜想反正没人看,随便写写,话说这还是我的第一篇博客。。。时间限制:1秒空间限制:32768K通过比例:4.49%参与人数:729题目描述nowcoder在家极度无聊,于是找了张纸开始统计素数的个数。设函数f(n)返回从1-n之间素数的个数。nowcoder发现:f(1)   = 0f(10)  

2015-12-18 21:39:07 628

数据结构与算法(java语言秒速)

数据结构与算法,用java写的,有需要的就下载看看吧

2015-10-25

visual c++可视化编程教程

很好的可视化编程材料 基础的必看 (特别适用于刚刚脱离dos窗口下编程的童鞋)

2014-07-11

关于c++的参考手册

新人发福利咯 本资料有详细的c++各种函数解析与用法

2014-05-26

空空如也

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

TA关注的人

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