- 博客(129)
- 收藏
- 关注
原创 linux下使用gdb调试nasm程序
nasm -f elf64 name.asm -g -F stabsgcc -o name name.o -ggdb namenasm -f elf name.asmld -m elf_i386 -o name name.o -Ttext 0x1000gdb namenasm -f elf64 name.asmld -o name name.o -Tt
2014-09-28 23:33:12 2494 1
原创 POJ 3436 ACM Computer Factory
DescriptionAs you know, all the computers used for ACM contests must be identical, so the participants compete on equal terms. That is why all these computers are historically produced at the same
2014-07-25 21:29:10 506
原创 ZOJ 1654 Place the Robots
Place the RobotsTime Limit: 5 Seconds Memory Limit: 32768 KBRobert is a famous engineer. One day he was given a task by his boss. The background of the task was the following:Given a
2014-07-17 18:33:33 650
原创 POJ1185 炮兵阵地
Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示: 如果在地图中的灰色所标识的平原上部署一支炮兵部队,则
2014-07-15 13:57:44 536
原创 UVA10944 - Nuts for nuts.. 状态压缩
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=21&page=show_problem&problem=1885
2014-05-13 21:22:29 795
原创 gh60(OK60RGB)刷固件折腾日志(MacOs版)
gh60(OK60RGB)刷固件折腾日志(MacOs版)由于平时开发使用vim,基本不用鼠标。只是偶尔查看文件,写设计文档画个图和浏览网页(网页也常使用qutebrowser 的仿vim操作)的时候才会用到,不太喜欢离开键盘去碰鼠标。所以,既然烧键盘了,就索性再添加一层鼠标操作层,这样在偶尔需要使用鼠标的时候直接切到这层去,比较省事。不过,出乎意料的是,tkg似乎并不支持鼠标按键,这时候只能使用[tmk_keybo
2017-11-18 14:24:11 5953
原创 unzip 解压windows上zip文件乱码的问题
对于gentoo而言,只需要为unzip的use标记加入natspec即可。我的unzip标记信息如下: USE="bzip2natspec unicode" ABI_X86="64"解压命令是: unzip -O CP936 windows中文压缩包.zip
2017-05-26 18:03:07 1385
原创 Linux/MacOS下matplotlib能正常显示的中文字体选择
下面的Python脚本可以检测到 *nix 系统内 matplotlib 支持正常显示的中文字体(用到了命令行工具 fc-list ):#!/usr/bin/env python# -*- coding: utf-8 -*-# File Name: font_check.py# Created Time: Thu Mar 23 16:53:59 2017__auth
2017-03-23 17:17:54 5271 1
原创 gentoo on macbook pro driver for the Broadcom Facetime HD webcam
gentoo on macbook pro 按 gentoo wiki 配置kernel 选项后, 仍然不能使用摄像头Device Drivers ---> Multimedia support ---> [*] Cameras/video grabbers support [*] Media USB Adapters ---> USB Video Clas
2017-01-17 11:13:06 1148
原创 My Gentoo kernel config on MacbookPro early 2015 13' Retina
## Automatically generated file; DO NOT EDIT.# Linux/x86 4.8.12-gentoo Kernel Configuration### Gentoo Linux#CONFIG_GENTOO_LINUX=yCONFIG_GENTOO_LINUX_UDEV=yCONFIG_GENTOO_LINUX_PORTAGE=y##
2016-12-20 16:27:05 10658
原创 linux使用ping批量测试脚本
最近使用的国外 vps 是来自 vultr.com的.官方给的pingi测试服务器列表如下:Location Looking GlassFrankfurt, DE fra-de-ping.vultr.comAmsterdam, NL ams-nl-ping.vultr.comParis, France par-fr-ping.vultr.comLond
2016-10-19 16:35:50 6566 3
原创 centos7 ip forwarding 的坑
在Centos6上允许ip转发只需要在 /etc/sysctl.conf里加入net.ipv4.ip_forward = 1 即可(reboot或用sysctl -p立即生效)可在Centos7里这样是远远不够的。这也导致了我在Centos7上,无论配pptp还是openvpn,都只能是正常连上服务,却不能正常上网。确定了服务配置的没有问题后,基本锁定是转发
2016-07-21 21:55:13 25782 5
原创 Archlinux 安装经验简要总结
#############grub###############pacman -S grub efibootmgr############软件源和软件包管理工具########pacman(wget)powerpillyaourtreflectorreflector -l 30 -f 12 | cat > mirrorlist#配置/etc/pa
2016-02-01 18:03:27 1268
原创 openSUSE系统下VirtualBox无法挂载主机USB设备问题的解决
这个问题几乎可以说是openSUSE系统下独有的问题,在网上查了很多资料,可查到的绝大部分都是说ubuntu上的相似问题,那问题很简单,其实就是他们没有将自己的的用户添加到vboxusers用户组上。而我确认自己的用户已经加入 vboxusers组、并且早就安装了 Oracle Extensions 扩展包,后来在推酷上发现一篇文章,才找到真正的解决方案。原来是
2015-09-24 12:25:19 607
原创 360公司 2016校园招聘在线笔试编程题
第一题将考研分数分类#include int main(){ int t, a, b, c, d, s; scanf("%d", &t); while(t--){ scanf("%d %d %d %d", &a, &b, &c, &d); s = a + b + c + d; if(a < 60 || b <60
2015-09-15 22:22:50 806
原创 POJ1419 Graph Coloring
DescriptionYou are to write a program that tries to find an optimal coloring for a given graph. Colors are applied to the nodes of the graph and the only available colors are black and white. The co
2015-08-19 17:10:17 611
原创 POJ1776 Task Sequences
URL:http://poj.org/problem?id=1776DescriptionTom has received a lot of tasks from his boss, which are boring to deal with by hand. Fortunately,Tom got a special machine - Advanced Computing Mach
2015-08-18 21:31:11 735
原创 uva216 Getting in Line
Computer networking requires that the computers in the network be linked.This problem considers a ``linear" network in which the computers are chained together so that each is connected to exactly t
2015-08-18 20:23:52 452
原创 linux系统下sublime text编译运行c++程序的配置文件
做了两个版本,一个运行程序时,将终端调出,方便交互。如下,因为我用的是kde桌面环境,所以常用终端的是konsole,对于gnome或其他桌面环境,改成gnome-terminal或x-terminal等终端即可。{ "shell_cmd": "g++ '${file}' -o '${file_path}/${file_base_name}'", "file_regex
2015-08-18 17:23:22 2847
原创 POJ2337/UVA10441 Catenyms
URL:http://poj.org/problem?id=2337URL:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=16&page=show_problem&problem=1382DescriptionA catenym is a pair of words
2015-08-18 13:46:37 525
原创 POJ3667 Hotel
URL:http://poj.org/problem?id=3667DescriptionThe cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bes
2015-08-17 11:02:39 376
原创 POJ2528 Mayor's posters
URL:http://poj.org/problem?id=2528DescriptionThe citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all p
2015-08-16 17:22:47 349
原创 POJ3468 A Simple Problem with Integers
线段树子区间更新维护#include struct interval_tree{ int nums[100010]; struct Node{ long long mark, sum; } node[100010 << 2]; void build(int l, int r, int i) { if (l == r) {no
2015-08-16 12:33:40 371
原创 LeeetCode #84 Largest Rectangle in Histogram
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width o
2015-08-14 19:17:44 488
原创 LeetCode #33 Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array return its
2015-08-14 16:31:12 404
原创 Leetcode #32 Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()", which
2015-08-14 12:50:45 382
原创 LeetCode Find Minimum in Rotated Sorted Array系列
#153 Find Minimum in Rotated Sorted ArraySuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum ele
2015-08-10 20:16:59 386
原创 LeetCode #164 Maximum Gap
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 if the array contains less than 2 elements
2015-08-10 12:44:10 413
原创 LeetCode #174 Dungeon Game
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially p
2015-08-10 11:40:34 468
原创 LeetCode #124 Binary Tree Maximum Path Sum
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 / \ 2 3Return 6.
2015-08-10 11:02:14 399
原创 LeetCode #200 Number of Islands
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assu
2015-08-10 10:10:26 449
原创 LeetCode #201 Bitwise AND of Numbers Range
Given a range [m, n] where 0 For example, given the range [5, 7], you should return 4.Credits:Special thanks to @amrsaqr for adding this problem and creating all test cases.结合二进制的特点,不难得到下面的结
2015-08-09 21:33:34 445
原创 Leetcode N-Queens系列
#51 N-QueensThe n-queens puzzle is the problem of placing n queens on ann×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the
2015-08-09 20:55:54 433
原创 LeetCode #202 Happy Number
Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares o
2015-08-09 13:10:49 426
原创 Leetcode House Robber系列
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house
2015-08-07 20:24:53 425
原创 LeetCode #214 Shortest Palindrome
Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can find by performing this transformation.For exam
2015-08-07 19:57:41 390
原创 Leetcode #209 Minimum Size Subarray Sum
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 instead.For example, given the array [2,3,1
2015-08-07 10:38:01 342
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人