自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(164)
  • 资源 (1)
  • 收藏
  • 关注

原创 LeetCode4. Median of Two Sorted Arrays

题目链接:https://leetcode.com/problems/median-of-two-sorted-arrays/给出两个有序数组,求得两个数组的中位数。时间复杂度要log(n+m)。题意简单,但属实有些不好想。有序,时间复杂度要log。很容易想到二分。先考虑偶数的情况。数组可以分成两个部分。 left rightA[0],A[1],……A[i-1], | A[i],A[i+1],……A[n-1]B[0],B[1],…

2021-02-27 11:12:39 212 1

原创 LeetCode 898. Bitwise ORs of Subarrays

题目链接:https://leetcode.com/problems/bitwise-ors-of-subarrays/description/枚举以第i个数结尾的运算的所有情况。class Solution {public: int subarrayBitwiseORs(vector<int>& A) { set<int> s;...

2018-09-08 21:40:00 299

原创 2018ICPC南京网络赛 B Call of Accepted 表达式求值

题目链接:https://nanti.jisuanke.com/t/31443表达式求值,对于每一步运算要保存一个最大值一个最小值,处理出现负负为正的情况。#include<bits/stdc++.h>#define ll long longusing namespace std;ll Judge(char c1,char c2){ ll a1,a2; if('+...

2018-09-08 21:31:25 306

转载 LeetCode 895. Maximum Frequency Stack

题目地址:https://leetcode.com/problems/maximum-frequency-stack/description/优先队列模拟栈class FreqStack {public: struct Node { int x,y,p; bool operator < (const Node &N) con...

2018-09-08 21:23:56 296

转载 LeetCode 894 All Possible Full Binary Trees

题目地址:https://leetcode.com/problems/all-possible-full-binary-trees/description/对二叉树的递归构造。对奇数枚举左右子树点的个数,偶数不符合条件直接返回/** * Definition for a binary tree node. * struct TreeNode { * int val; ...

2018-09-08 21:21:23 205

转载 牛客多校赛第九场 E Music Game 概率计算

链接:https://www.nowcoder.com/acm/contest/147/E来源:牛客网 题目描述Niuniu likes to play OSU!We simplify the game OSU to the following problem. Given n and m, there are n clicks. Each click may succes...

2018-08-21 11:40:59 299

转载 树上的启发式合并 CF1009 F. Dominant Indices

http://codeforces.com/contest/1009/problem/F讲解:http://codeforces.com/blog/entry/44351讲解中的问题是解决树上结点特性查询,而本题是查询相对于一个结点每一层根的个数。#include<bits/stdc++.h>#define maxn 1000010using namespace st...

2018-08-14 20:37:22 221

原创 牛客多校第七场 J Sudoku Subrectangles

链接:https://www.nowcoder.com/acm/contest/145/J来源:牛客网 You have a n * m grid of characters, where each character is an English letter (lowercase or uppercase, which means there are a total of 52 diff...

2018-08-11 09:48:07 208

原创 牛客多校第七场 C Bit Compression

链接:https://www.nowcoder.com/acm/contest/145/C来源:牛客网 题目描述A binary string s of length N = 2n is given. You will perform the following operation n times :- Choose one of the operators AND (&),...

2018-08-11 09:24:54 225

原创 杭电多校第三场 HDU 6300 Problem L. Visual Cube 水题 模拟

Problem L. Visual CubeTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 455    Accepted Submission(s): 322 Problem DescriptionLittle Q l...

2018-07-31 21:10:17 220

原创 杭电多校第三场 HDU 6319 Problem A. Ascending Rating (模拟单调队列)

Problem A. Ascending RatingTime Limit: 10000/5000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 3701    Accepted Submission(s): 1225 Problem DescriptionBe...

2018-07-31 20:59:50 233

原创 杭电多校第三场HDU6321 Problem C. Dynamic Graph Matching (状压DP)

 Problem C. Dynamic Graph MatchingTime Limit: 8000/4000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1238    Accepted Submission(s): 516 Problem Descript...

2018-07-31 20:47:11 194

原创 牛客多校第二场 J.Farm

题目链接:https://www.nowcoder.com/acm/contest/140/J题目描述 White Rabbit has a rectangular farmland of n*m. In each of the grid there is a kind of plant. The plant in the j-th column of the i-th row belon...

2018-07-23 11:13:19 262

转载 牛客多校第一场 J.Different Integers

原博地址:https://www.nowcoder.com/discuss/87249题目描述 Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., (lq, rq), find count(l1, r1), count(l2, r2), ..., coun...

2018-07-21 11:59:32 264

原创 HDU 5929 Basic Data Structure 双向队列

Mr. Frog learned a basic data structure recently, which is called stack.There are some basic operations of stack: ∙∙ PUSH x: put x on the top of the stack, x must be 0 or 1. ∙∙ POP: throw the elemen...

2018-07-19 10:16:55 188

原创 ZOJ - 3735 Josephina and RPG

Josephina and RPGTime Limit: 2 Seconds      Memory Limit: 65536 KB      Special JudgeA role-playing game (RPG and sometimes roleplaying game) is a game in which players assume the roles of characters ...

2018-06-03 09:35:19 295

原创 2018 西电校赛 E Xieldy And His Password DP

链接:https://www.nowcoder.com/acm/contest/107/E来源:牛客网题目描述众所周知,Xieldy最常用的口令是******。 为了改变这一现状,他random了一个01串,并从中截取了一段作为自己的口令。 他选择的口令满足以下条件: 1. 口令串表示的二进制数在十进制下可以被表示为3k(k>=0)。 2. 口令串可以有前导零。 现已经random出了01串...

2018-04-30 15:36:58 405

原创 2018 华中科技大学校赛 F Sorting Trees

链接:https://www.nowcoder.com/acm/contest/106/F来源:牛客网t’s universally acknowledged that there’re innumerable trees in the campus of HUST. One day the tree manager of HUST asked you to sort N trees ...

2018-04-30 14:23:24 379

原创 2018 华中科技大学校赛 L Fresh Air 思维BFS

链接:https://www.nowcoder.com/acm/contest/106/L来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST.And you know that, trees have the special ability to refresh the ...

2018-04-30 11:34:33 453

原创 2018 华中科技校赛 K Walking in the Forest 最大化最小值

链接:https://www.nowcoder.com/acm/contest/106/K来源:牛客网题目描述 It’s universally acknowledged that there’re innumerable trees in the campus of HUST.Now you're going to walk through a large forest. There is a ...

2018-04-30 11:25:02 276

原创 2018华中科技大学校赛 B Beautiful Trees Cutting 等比数列 快速幂 逆元

链接:https://www.nowcoder.com/acm/contest/106/B来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST.One day Xiao Ming is walking on a straight road and sees many tre...

2018-04-30 11:15:25 300

原创 ZOJ-4016 Mergeable Stack 链表模拟栈

题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4016链表模拟  怕爆内存 把所有申请空间的指针都放到一个vector里消除 结果超时。。。 每次top的时候删除居然不会爆内存。。#include<bits/stdc++.h>#define maxn 100010#define ll long lon...

2018-04-09 16:56:53 199

转载 L3-001. 凑零钱

韩梅梅喜欢满宇宙到处逛街。现在她逛到了一家火星店里,发现这家店有个特别的规矩:你可以用任何星球的硬币付钱,但是绝不找零,当然也不能欠债。韩梅梅手边有104枚来自各个星球的硬币,需要请你帮她盘算一下,是否可能精确凑出要付的款额。输入格式:输入第一行给出两个正整数:N(<=104)是硬币的总个数,M(<=102)是韩梅梅要付的款额。第二行给出N枚硬币的正整数面值。数字间以空格分隔。输出格式...

2018-03-29 22:20:18 245

原创 CodeForce 923A PromalSport

B. Primal Sporttime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice and Bob begin their day with a quick game. They first choose a starting num...

2018-03-17 10:33:39 287

转载 Codeforces 470Div 2 C. Producing Snow

C. Producing Snowtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice likes snow a lot! Unfortunately, this year's winter is already over, and she...

2018-03-11 13:12:01 456

原创 Codeforce 931 C. Laboratory Work

C. Laboratory Worktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnya and Kirill are doing a physics laboratory work. In one of the tasks they hav...

2018-03-10 11:53:58 211

原创 Codeforces 950 C. Zebras

C. Zebrastime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputOleg writes down the history of the days he lived. For each day he decides if it was good ...

2018-03-10 11:39:23 395

原创 HDU-2897 邂逅明下

邂逅明下Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5267    Accepted Submission(s): 2451Problem Description当日遇到月,于是有了明。当我遇到了你,便成

2018-01-31 11:34:34 252

转载 博弈题目小结

原博地址:http://blog.csdn.net/ACM_cxlove?viewmode=contents 首先当然要献上一些非常好的学习资料:基础博弈的小结:http://blog.csdn.net/acm_cxlove/article/details/7854530经典翻硬币游戏小结:http://blog.csdn.net/acm_cxlove/article/

2018-01-30 19:27:15 293

原创 Uva -11624 Fire!

原题链接:https://vjudge.net/problem/UVA-11624双入口同时BFS#include#define INF 10001010using namespace std;char M[1010][1010];int T[1010][1010];bool judgej[1010][1010];bool judgef[1010][1010];int n

2018-01-30 17:37:16 235

原创 Uva10047 The Monocycle

原题链接:https://vjudge.net/problem/UVA-10047绞尽脑汁的图论题,虽然只是bfs但是要求到达的最小时间以及符合到达终点的条件还是需要思考一番。用优先队列保证到达时间最小,每一个方块的访问方式由进入的方向以及轮子的颜色划分。#include#define INF 0x3f3f3f3fusing namespace std;int n,m;int

2018-01-30 17:32:52 287

原创 51Nod 1298 圆与三角形 计算几何

1298 圆与三角形题目来源: HackerRank基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题给出圆的圆心和半径,以及三角形的三个顶点,问圆同三角形是否相交。相交输出"Yes",否则输出"No"。(三角形的面积大于0)。Input第1行:一个数T,表示输入的测试数量(1 <= 

2018-01-30 10:29:03 452

原创 HDU 2586 How far a way

勇气小镇是一个有着n个房屋的小镇,为什么把它叫做勇气小镇呢,这个故事就要从勇气小镇成立的那天说起了,修建小镇的时候,为了让小镇有特色,镇长特地只修了n-1条路,并且规定说,所有在勇气小镇的村民,每一次出门必须规划好路线, 路线必须满足在到达终点之前绝对不走回头路。每个人都要这样,不然那个人就不配在小镇生活下去,因为他没有这个勇气。事实上,这并不能算一项挑战,因为n-1条路已经连通了每户

2018-01-29 19:47:50 329

原创 CodeForces - 96D Volleyball 最短路

D. Volleyballtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya loves volleyball very much. One day he

2018-01-29 19:33:37 537

原创 51Nod 1119 机器人走方格 组合数模板

机器人走方格V2M*N的方格,一个机器人从左上走到右下,只能向右走或向下走。有多少种不同的走法?由于方法数量可能很大,只需要输出MOD^9+7的结果。第一行,2个数M,N中间用空格隔开。(21000000)输出走法数量Mod 10^9+7#include#define ll long long#define maxn 2000010 #define mod 100000000

2018-01-29 19:08:02 218

原创 51Nod 1265 四点共面

1265 四点共面基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题给出三维空间上的四个点(点与点的位置均不相同),判断这4个点是否在同一个平面内(4点共线也算共面)。如果共面,输出"Yes",否则输出"No"。Input第1行:一个数T,表示输入的测试数量(1 <= T <= 1000)第2 - 4T +

2018-01-29 17:52:12 247

原创 POJ 1190生日蛋糕

生日蛋糕Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 21221 Accepted: 7546Description7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体。 设从下往上数第i(1 R

2018-01-29 17:42:51 294

原创 HDU 1556 Color the ball

Color the ballTime Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24404    Accepted Submission(s): 11853Problem DescriptionN个气球排成一排,

2018-01-24 10:58:43 214

原创 HDU 1978 How many ways

How many waysTime Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5987    Accepted Submission(s): 3508Problem Description这是一个简单的生存游戏,

2018-01-24 10:50:35 264

转载 最长公共子序列

原文地址:http://blog.csdn.net/hrn1216/article/details/515346071.基本概念      首先需要科普一下,最长公共子序列(longest common sequence)和最长公共子串(longest common substring)不是一回事儿。什么是子序列呢?即一个给定的序列的子序列,就是将给定序列中零个或多个元素去掉之

2018-01-21 09:16:41 203

Java课设学生选课系统

Java学生选课系统 有界面 采用文档存储无数据库 初次使用 管理员账户:DlPF 密码:961227 所有信息要手动添加

2018-07-31

空空如也

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

TA关注的人

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