Skip to content

Instantly share code, notes, and snippets.

Rui Wang isnowfy

Block or report user

Report or block isnowfy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:7329736
#include<iostream>
#include<string>
using namespace std;
int n,m;
int aa(string s){
int t=0;
for(int i=0;i<n;i++)
for(int j=i+1;j<n;j++)
if(s[i]>s[j])
t++;
View dft.py
# Example usage
# $ python dft.py | gnuplot
# 9
# 0 0
# 1 1
# 2 2
# 0 2
# 1 1
# -1 1
# 0 2
@isnowfy
isnowfy / gist:5087654
Last active Dec 14, 2015
stable partition
View gist:5087654
import random
def partition(arr):
index = odd = 0
maxn = arr[0]
for i in range(len(arr)):
if arr[i] % 2 == 1:
odd += 1
maxn = max(maxn, arr[i])
maxn += 1
View pinyin.py
#!/usr/bin/env python
#vim: encoding=utf-8
import unittest
from pprint import pprint
py = set([u'gu', u'qiao', u'qian', u'ge', u'gang', u'ga', u'lian', u'liao', u'rou', u'zong', u'tu', u'seng', u'ti', u'te', u'ta', u'nong', u'zhang', u'fan', u'tuan', u'gua', u'die', u'gui', u'guo', u'gun', u'sang', u'diu', u'tei', u'zi', u'ze', u'za', u'chen', u'zu', u'ruo', u'dian', u'diao', u'nei', u'suo', u'sun', u'zhao', u'sui', u'kuo', u'kun', u'kui', u'zhai', u'zuan', u'kua', u'bo', u'ning', u'lei', u'neng', u'men', u'mei', u'geng', u'chang', u'shua', u'cha', u'che', u'fen', u'chi', u'fei', u'chu', u'shui', u'me', u'ma', u'mo', u'mi', u'mu', u'dei', u'cai', u'zhan', u'cao', u'can', u'den', u'wang', u'beng', u'zhuang', u'tan', u'tao', u'tai', u'eng', u'song', u'ping', u'hou', u'cuan', u'\u0148g', u'lan', u'lao', u'fu', u'fa', u'jiong', u'mai', u'xiang', u'mao', u'fo', u'a', u'jiang', u'kuang', u'bing', u'su', u'si', u'sa', u'se', u'zan', u'm\u0300', u'xuan', u'zei', u'zen', u'kong', u'pang', u'le', u'jia', u'jin', u'lo
You can’t perform that action at this time.