Skip to content

Instantly share code, notes, and snippets.

View logicmd's full-sized avatar

Kevin Tong logicmd

  • Meta
  • Seattle
View GitHub Profile
@logicmd
logicmd / SpeakinginTongues.cpp
Created July 17, 2012 06:22
Problem A. Speaking in Tongues
/*************************************************************************
Author: logicmd
Created Time: 2012/7/16 19:55:16
File Name: Problem A. Speaking in Tongues.cpp
Description:
This problem is so damn. The problem description gives participant a
one to one mapping relation, and it just letter 'z'.
So the best solution is not to built a hashmap yourself, but to build a
map manually brutely. WTF
@logicmd
logicmd / Preferences.sublime-settings.json
Created July 20, 2012 15:43
Preferences sublime settings
{
"font_size": 11.0,
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"shift_tab_unindent": true,
"rulers": [80]
}
@logicmd
logicmd / _vimrc
Created July 20, 2012 15:45
Vim config
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
@logicmd
logicmd / RecycledNumbers.cpp
Created July 24, 2012 14:42
Problem C. Recycled Numbers
/*************************************************************************
Author: logicmd
Created Time: 2012/7/24 17:43:17
File Name: RecycledNumbers.cpp
Description:
************************************************************************/
#include <cassert>
#include <iostream>
#include <set>
#include <map>
@logicmd
logicmd / TextNormalizer.java
Created July 31, 2012 08:59
Text Normalizer
/*
* Text Normalizer
* To remove all punctuation, extra spacing
* And transforming into lower case.
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
@logicmd
logicmd / A.cpp
Created September 1, 2012 09:08
ZOJ 8-15 Problem A
/*************************************************************************
Author: logicmd
Created Time: 2012/8/21 23:37:36
File Name: A.cpp
Description:
************************************************************************/
#include <cassert>
#include <iostream>
#include <vector>
@logicmd
logicmd / gist:3654887
Created September 6, 2012 11:08
Adblock Additional file
http://copy.ousns.com/*.swf
http://fmn.rrimg.com/fmn053/20110812/1055/b_large_yxq9_338b00030b745c71.jpg
http://jebe.xnimg.cn/20110803/09/010366b8-542a-4aa0-b6b7-e0e040e14317.swf
http://jebe.xnimg.cn/20110808/10/0795f274-8810-4a04-ae84-1500c9a594d3.jpg
http://jebe.xnimg.cn/20110810/14/66713e54-c9eb-4a5b-971d-46e7c917216f.jpg
http://static.googleadsserving.cn/pagead/imgad?id=CIuC6LP-9rTggwEQrAIY-gEyCJ48Kmi6VgYK
http://static.googleadsserving.cn/pagead/imgad?id=CNLU85Gn7YLIHhCsAhj6ATIIW1eIa_qlG8A
http://ww3.sinaimg.cn/large/3e2fd48ajw1dwklpiyjz4j.jpg
renren.com###ad1000032270000200001_1312780720258_adbox100000000075flashsocial
renren.com###ad1000032270000200001_1312780720258_adbox100000000075sflashobj
@logicmd
logicmd / CardStacking.cpp
Created September 12, 2012 12:47
Card Stacking
/*************************************************************************
Author: logicmd
Created Time: 2012/9/12 19:12:56
File Name: CardStacking.cpp
Description:
************************************************************************/
#include <cassert>
#include <iostream>
#include <set>
@logicmd
logicmd / coin.m
Created September 12, 2012 13:53
有两堆硬币,一堆有27个,一堆有26个,分别抛这两堆硬币,哪堆的正面朝上的硬币数量多,哪堆算赢。问,27个硬币的那堆赢的概率有多少?输的概率有多少
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 有两堆硬币,一堆有27个,一堆有26个,分别抛这两堆硬币, %
% 哪堆的正面朝上的硬币数量多,哪堆算赢。问,27个硬币的那 %
% 堆赢的概率有多少?输的概率有多少? %
% %
% %
% p_win = 0.5000, p_lose = 0.3919 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/*************************************************************************
Author: logicmd
Created Time: 2012/9/12 20:51:57
File Name: Spell Checker.cpp
Description:
************************************************************************/
#include <cassert>
#include <iostream>
#include <vector>