自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

醉醉的博客

一个ACMer的成长之路

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

原创 字节对齐学习笔记

首先要分清楚三个概念:自身对齐值、指定对齐值、有效对齐值。自身对齐值:数据类型本身的对齐值,例如char类型的自身对齐值是1,short类型是2;指定对齐值:编译器或程序员指定的对齐值,32位单片机的指定对齐值默认是4;有效对齐值:自身对齐值和指定对齐值中较小的那个。...

2019-07-24 11:14:38 240

原创 TinyURL记录

之前去网易游戏面试,结果凉了。当时面试官问了我一个问题:如何实现一个短网址(Tiny url)系统。当时我只说是建立一个映射,就跟哈希表的原理差不多。然后面试官问我用较短的网址去映射那么多的较长的网址,短网址够用吗?我当时理所当然地觉得:不够用,很快就否认了自己先前的想法。然后就慌了,接下来基本上啥也没说上来。。。后来上网查这个问题的做法,发现LeetCode就有= =,而且其实思

2017-12-26 15:51:21 393

原创 [LeetCode] Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘

2017-11-29 11:30:55 178

原创 [LeetCode] Subtree of Another Tree

题目链接:点击打开链接Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and

2017-11-14 14:27:16 221

原创 [LeetCode] Poor Pigs

There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison it will die within 15 minutes. What is the minimum

2017-11-09 14:28:03 294

原创 根据先序遍历数列和中序遍历数列重建二叉树

题目描述输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。这题乍看之下无从下手,实际上也不难。/** * Definition for binary tree * struct TreeNode

2017-09-26 11:05:00 2119

原创 [LeetCode] Binary Watch

A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED represents a zero or one, with the least significant bit

2017-09-20 14:54:25 205

原创 hdu4463 Outlets

这是一道最小生成树模板题#include#include#include#includeusing namespace std;const int INF=400;int n,p1,p2;double tempDist,ans;struct node{ int x; int y;}points[51];double dist[51][51];doubl

2017-09-20 13:12:20 170

原创 Socket编程学习记录

最近在鼓捣Ubuntu,开始正式学习Socket网络编程。今晚跟着教程做好了一个echo服务器,还挺有成就感的。服务器端:echosrv.c#include #include #include #include #include #include #include #include #define ERR_EXIT(m)\do\{\ perror(m);\

2017-08-15 00:11:21 249

原创 关于lowbit函数

lowbit(x)是x的二进制表达式中最低位的1所对应的值。比如,6的二进制是110,所以lowbit(6)=2。最近回头看树状数组,发现关于lowbit()函数,目前有两种算法。第一种是比较常见的,也是我一直在用的:int lowbit(int x){ return x&(-x);}最近发现了另一种算法,如下所示:int lowbit(int

2017-04-11 13:02:42 40468 2

原创 HDU 1000 A + B Problem

作为经典的ACM入门题,这应该是很多人入坑时做的第一道题,可以说,A+B问题对ACMer的意义相当于Hello World对于程序员的意义。很多题目很简单,但是有些人知道做法也不一定能AC,因此借这道题讲讲初学者可能遇到的种种问题。让我们先来看题。Problem DescriptionCalculate A + B. InputEach line

2016-05-09 19:16:34 1618 1

原创 2016 GDCPC 赛后小感

昨天去中大参加了2016的广东ACM省赛,结果并不令人满意,只AC了五题,估计连铜牌也拿不到。虽然是发生了很多状况,导致有两道简单的题目也没有做,但是主要原因还是我们的个人实力不足。说实话,比赛完我们三个都挺沮丧的。这个成绩,去到别的学校,估计连校队都进不了吧。这是我第二次参加省赛了,去年也是在中大。一年过去了,自己似乎还是老样子,并没有什么进步和成长。最初自己只是觉得打ACM挺有意思

2016-05-09 17:53:22 783 3

空空如也

空空如也

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

TA关注的人

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