Skip to content

Instantly share code, notes, and snippets.

View fanzeyi's full-sized avatar

Zeyi (Rice) Fan fanzeyi

View GitHub Profile
#include <cstdlib>
#include <cstdio>
#include <cstring>
#define MAX_ITEM 32
#define MAX_WEIGHT 20002
#define fin stdin
#define fout stdout
int n;
int max;
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define MAX_ELEMENT 10001
inline int fmax(int a, int b) {
return a > b ? a : b;
}
int n;
@fanzeyi
fanzeyi / buynow.cpp
Created September 15, 2012 17:08
USACO buynow
/*
USER: fanzeyi1
TASK: buylow
LANG: C++
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define MAX_DAY 5001
#define MAX_NUM 20001
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define MAX_PEOPLE 101
int n;
int result;
int height[MAX_PEOPLE];
int height_r[MAX_PEOPLE];
int f[MAX_PEOPLE];
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define MAX_MISSILE 1001
#define fin stdin
#define fout stdout
int n;
int height[MAX_MISSILE];
int f[MAX_MISSILE];
x = [lambda: x for x in range(10)]
print x[0]()
'''
俺的第一反应是 x = [lambda: 1, lambda: 2, ...]
但是实际上是 x = [lambda x, lambda x], 所以返回的应该是这个 lambda list
'''
x = (lambda: x for x in range(10))
print x.next()()
'''
import calendar
START_YEAR = 2012
END_YEAR = 2012
START_MONTH = 7
END_MONTH = 7
cal = calendar.Calendar()
result = ["&year=%d&month=%d&day=%d" % (year, month, day) \
for year in range(START_YEAR, END_YEAR + 1) \
import calendar
START_YEAR = 2012
END_YEAR = 2012
START_MONTH = 7
END_MONTH = 7
cal = calendar.Calendar()
result = ["&year=%d&month=%d&day=%d" % (year, month, day) \
for year in range(START_YEAR, END_YEAR + 1) \
@fanzeyi
fanzeyi / rc,lua
Created July 16, 2012 10:04
awesome.config
-- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
naughty.config.default_preset.width = 400
import grequests
BASE_PATH = 'http://xxxxx.com/web/_photo/pic/'
urls = ["%d0000%s%d" % (year, '0'*(4-len(str(no))), no) for year in range(2005, 2012) for no in range(2001)]
rs = (grequests.get(BASE_PATH + u + '.JPG') for u in urls)
result = grequests.map(rs)