自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

far away

The track curved away below him.

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

原创 61-65题 题解

61. Rotate ListGiven a list, rotate the list to the right by k places, where k is non-negative.Example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.//如果k大于链表长度时,应

2018-01-31 21:49:16 358

原创 56-60题 题解

56. Merge IntervalsGiven a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].//不明白排序函数为什么要写成静态的/** *

2018-01-31 21:40:35 320

原创 51-55题 题解

51. N-QueensThe n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the

2018-01-31 21:33:37 289

原创 46-50题 题解

46. PermutationsGiven a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1],

2018-01-31 21:26:41 271

原创 41-45题 题解

41. First Missing PositiveGiven an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run

2018-01-31 21:19:32 266

原创 36-40题 题解

36. Valid SudokuDetermine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.

2018-01-31 21:13:22 219

原创 31-35题 题解

31. Next PermutationImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearran

2018-01-31 21:06:31 244

原创 26-30题 题解

26. Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space

2018-01-31 20:59:18 188

原创 21-25题 题解

21. Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2

2018-01-31 20:48:33 216

原创 Leetcode- 16-20题 题解

16. 3Sum ClosestGiven an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each

2018-01-05 20:32:21 324

原创 Leetcode- 11-15题 题解

11. Container With Most WaterGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of l

2018-01-04 21:49:56 177

原创 Leetcode- 06-10题 题解

6. ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibil

2018-01-03 10:17:00 277

原创 Leetcode- 1-5题 题解

最近开始刷Leetcode了,大三狗还没有找到实习,很菜啊,希望明年三月份能找份实习工作吧!2017年最后一篇博客,明天都元旦了,提前对大家说元旦快乐哈!下面所有代码在我GitHub上也有,地址:https://github.com/zzuliLL/Leetcode-1. Two SumGiven an array of integers, return indices o

2017-12-31 21:55:36 288 1

原创 牛客练习赛9 B 珂朵莉的值域连续段

题目链接:https://www.nowcoder.com/acm/contest/40/B时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 131072K,其他语言262144K64bit IO Format: %lld题目描述珂朵莉给你一个有根树,求有多少个子树满足其内部节点编号在值域上连续一些数在值域上连续的意思即其在值

2017-12-30 11:12:07 263

原创 Python 3.xx socket编程 - 简单通讯软件 - Client/Server

最近自学的python基础,刚看了一些socket(套接字)编程,写了一个简单的通讯软件,分为客户端和服务器,在同一台主机或者两台不同的主机间的通信代码:# Clientimport sockets=socket.socket(socket.AF_INET,socket.SOCK_STREAM)s.connect(("172.20.204.130",8888)) # 目的服务器

2017-12-22 21:32:14 414

原创 Wannafly挑战赛4 C 割草机

题目链接:https://www.nowcoder.com/acm/contest/35/C时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述有一块n*m的地,每块地要么长满杂草(用'W'表示),要么是空地(用'G'表示),现在有一个人站在(1,1),面向

2017-11-25 10:22:30 447

原创 Wannafly挑战赛4 A 解方程

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

2017-11-25 10:17:29 412

原创 牛客练习赛6 D 世界上最可爱的珂朵莉

题目链接:https://www.nowcoder.com/acm/contest/26/D时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 65536K,其他语言131072K64bit IO Format: %lld题目描述我永远喜欢珂朵莉~!有两个长为n的序列a[i]与b[i]你可以把任意不多于x个a序列中的数变

2017-11-18 14:25:16 529

原创 牛客练习赛6 A 猴子吃香蕉(等差数列)

题目链接:https://www.nowcoder.com/acm/contest/26/A题目描述有n只猴子,第i只猴子每过xi小时会连续吃香蕉yi小时。猴子从第二次开始每次休息结束后这只猴子连续吃香蕉的时间会增加zi小时。给定n只猴子,每一只的xi,yi,zi,以及时间t,求在前t小时中,所有猴子共吃了多少小时。 对于一只猴子来说是这样的:从第1小时开始

2017-11-18 14:21:09 633

原创 hihocoder #1620 : 股票价格3

题目链接:http://hihocoder.com/problemset/problem/1620解析:维护一棵树,树根里面存(没有找到第一个大于该值的)最小值的编号,一直维护就好了,借鉴大佬得100分的代码代码:#include<stdio.h>#include<algorithm>#include<string.h>#include<queue>using namespace std;t

2017-11-05 17:43:50 265

原创 hihocoder #1619 : “共同富裕”

题目链接:http://hihocoder.com/problemset/problem/1619解析:看别人的代码才知道,最小步数应该是每一个数到达最小值的步数之和,小的变成大的,小的+1,变相就是大的-1代码:#include<stdio.h>#include<algorithm>#include<string.h>#include<queue>using namespace std;t

2017-11-05 17:39:14 1079

原创 Atcoder arc 084 D - Small Multiple(双向队列+抽屉原理)

题目链接:http://arc084.contest.atcoder.jp/tasks/arc084_bD - Small MultipleTime limit : 2sec / Memory limit : 256MBScore : 700 pointsProblem StatementFind the smallest possi

2017-11-05 17:33:36 885

原创 Atcoder arc 084 C - Snuke Festival(前缀和+二分)

题目链接:http://arc084.contest.atcoder.jp/tasks/arc084_aC - Snuke FestivalTime limit : 2sec / Memory limit : 256MBScore : 300 pointsProblem StatementThe season for Snuke Festival

2017-11-05 17:28:17 833

原创 hdu 6227 Rabbits

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6227 解析:给你n个位置,选其中一个往另外其它两个位置的中间插,问能插几次 代码:#include<bits/stdc++.h>using namespace std;typedef long long LL;int a[509], b[509];int main(){ int t,

2017-11-05 17:15:30 694

原创 hdu 6225 Little Boxes

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6225 解析:求四个数的和,大整数加法 代码:import java.io.*;import java.math.BigInteger;import java.util.*;public class Main { public static Scanner s = new Scanner(

2017-11-05 17:11:43 842

原创 hdu 6222 Heron and His Triangle

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6222 解析:规律:a[n] = 4*a[n-1] - a[n-2] 代码:import java.io.*;import java.math.BigInteger;import java.util.*;public class Main { public static Scanner s

2017-11-05 17:09:13 1209

原创 Wannafly模拟赛5 D Aria(全排列)

题目链接:https://www.nowcoder.com/acm/contest/18/D时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 Aria是一名武侦高强袭科的学生,由于悬殊的实力差距,没有人可以 与她配合。所以正如她的名字一样(Aria在歌剧中有独唱曲之意),Aria一直

2017-11-05 17:02:21 314

原创 Wannafly模拟赛5 A Split

题目链接:https://www.nowcoder.com/acm/contest/18/A

2017-11-05 16:47:21 336

原创 Wannafly挑战赛2 B Travel(dij)

题目链接:https://www.nowcoder.com/acm/contest/17/B时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述精灵王国有N座美丽的城市,它们以一个环形排列在Bzeroth的大陆上。其中第i座城市到第i+1座城市花

2017-10-28 16:25:55 686

原创 Wannafly模拟赛4 C Sum(树状数组)

题目链接:https://www.nowcoder.com/acm/contest/16/C时间限制:1秒 空间限制:131072K题目描述考虑维护一个这样的问题:(1) 给出一个数组A,标号为1~n(2) 修改数组中的一个位置。(3) 询问区间[l,r]中所有子集的位运算and之和mod(109+7)。位运算and即为“pascal中的and”和“

2017-10-21 16:11:23 388

原创 Wannafly模拟赛4 D Fancy Signal Translate(字典树)

题目链接:https://www.nowcoder.com/acm/contest/16/D时间限制:1秒 空间限制:131072K题目描述FST是一名可怜的小朋友,他很强,但是经常fst,所以rating一直低迷。但是重点在于,他真的很强!他发明了一种奇特的加密方式,这种加密方式只有OIer才能破解。这种加密方式是这样的:对于一个01串,他会构造另一个01

2017-10-21 11:56:33 364

原创 Wannafly模拟赛4 B Distance

题目链接:https://www.nowcoder.com/acm/contest/16/B时间限制:1秒 空间限制:131072K题目描述FST作为小朋友,经常会遇到和距离有关的问题,但是他已经厌倦了曼哈顿距离和欧几里德距离,所以FST就定义了一种FST距离。这种距离并不用于空间或平面中,而运用于FST发明的一些神奇的算法中(唔... ...)。设i号元素

2017-10-21 11:52:31 323

原创 Wannafly模拟赛4 A Laptop (RMQ)

题目链接:https://www.nowcoder.com/acm/contest/16/A时间限制:1秒 空间限制:131072K题目描述FST是一名可怜的小朋友,他很强,但是经常fst,所以rating一直低迷。但是重点在于,他非常适合ACM!并在最近的区域赛中获得了不错的成绩。拿到奖金后FST决定买一台新笔记本,但是FST发现,在价格能承受的范围内,笔

2017-10-21 11:46:40 394

原创 hdu 2586 How far away ? (LCA转RMQ)

题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2586How far away ?Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18268    Accept

2017-10-15 15:42:04 275

原创 Wannafly挑战赛1 B Xorto

题目链接:https://www.nowcoder.com/acm/contest/15/B题目描述给定一个长度为n的整数数组,问有多少对互不重叠的非空区间,使得两个区间内的数的异或和为0。输入描述:第一行一个数n表示数组长度;第二行n个整数表示数组;1输出描述:一行一个整数表示答案。示例1输入30 0 0输出

2017-10-14 12:14:54 490

原创 Wannafly挑战赛1 A Treepath

题目链接:https://www.nowcoder.com/acm/contest/15/A时间限制:1秒 空间限制:32768K题目描述给定一棵n个点的树,问其中有多少条长度为偶数的路径。路径的长度为经过的边的条数。x到y与y到x被视为同一条路径。路径的起点与终点不能相同。输入描述:第一行一个数n表示点的个数;接下来n-1行,每行两个整数x,y表示边;

2017-10-14 12:10:05 342

原创 杜教模板(转载一篇cpp文件)

#include #include #include #include #include #include #include #include #include using namespace std;#define rep(i,a,n) for (int i=a;i<n;i++)#define per(i,a,n) for (int i=n-1;i>=a;i--)#def

2017-10-13 16:58:50 781

原创 sql学习日志1

select create drop alterinsert update deletegrant revokecreate schema __ drop schema __  创建模式create table  __ drop table  __ alter table 创建删除修改表create view   __ drop view 视图crate index

2017-10-12 18:07:32 306

原创 hdu 5269 ZYB loves Xor I(字典树)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5269ZYB loves Xor ITime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1149    Accepted

2017-09-08 16:21:25 301

原创 51 NOD 1010 只包含因子2 3 5的数(暴力枚举)

题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=10101010 只包含因子2 3 5的数基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题 收藏 关注K的因子中只包含2 3 5。满足条件的前10个数

2017-08-29 16:04:20 302

空空如也

空空如也

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

TA关注的人

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