Skip to content

Instantly share code, notes, and snippets.

View LXZE's full-sized avatar
🌏
Finding remote works or relocation offers

林卓偉 LXZE

🌏
Finding remote works or relocation offers
  • The world's longest capital city name, Thailand
  • 23:37 (UTC +07:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am lxze on github.
  • I am lxze (https://keybase.io/lxze) on keybase.
  • I have a public key ASCi3jBr-i7_DHkJ0QvNmrCkhHZ8cjnMOk9W7lbfQ0G-YQo

To claim this, I am signing this object:

@LXZE
LXZE / q_c.py
Last active April 12, 2016 17:54
Google Codejam 2016 Qualification round : Coin Jam
from math import sqrt;
from itertools import count, islice
f = open("input.in","r")
w = open("output.txt","w")
num = f.readline()
def convert(input, source, target):
if source == target: return input
base = {
2 :'01',
3 :'012',
@LXZE
LXZE / q_b.py
Created April 12, 2016 17:52
Google Codejam 2016 Qualification round : Revenge of the Pancakes
f = open("input.in","r")
w = open("output.txt","w")
num = f.readline()
for it in range(0,int(num)):
pancakes = f.readline().rstrip('\n')
res = 0
state = ''
txt = ''
for ch in pancakes:
@LXZE
LXZE / q_a.py
Last active April 12, 2016 17:52
Google Codejam 2016 Qualification round : Counting sheep
f = open("input.in","r")
w = open("output.txt","w")
num = f.readline()
for it in range(0,int(num)):
res = ''
num = int(f.readline())
if num == 0:
res = 'INSOMNIA'
else:
idx = 0
@LXZE
LXZE / codehew_2.py
Created January 19, 2016 15:11
review sequence
# f = open("in2.in","r")
f = open("review_input.txt","r")
w = open("output.txt","w")
num = f.readline()
for it in range(0,int(num)):
comment = [int(l) for l in f.readline().split()][1:]
comment.sort()
res = [ [comment[0],comment[0]] ]
bf = comment[0]
for i,num in enumerate(comment[1:]):
@LXZE
LXZE / codehew_3.py
Last active January 19, 2016 17:37
code hew - interstella
from itertools import *
def powerset(iterable):
s = list(iterable)
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
f = open("interstellar_input.txt","r")
# f = open("in.in","r")
w = open("output.txt","w")
num = f.readline()
import re
from fractions import gcd
def lcm(numbers):
return reduce(lambda x, y: (x*y)/gcd(x,y), numbers, 1)
f = open("B-large.in","r")
w = open("output_blarge.txt","w")
num = f.readline()
for i in range(0,int(num)):
barber,atN = [long(l) for l in f.readline().split()]
speed = [int(l) for l in f.readline().split()]
import re
f = open("A-large.in","r")
w = open("output_aLarge.txt","w")
num = f.readline()
for i in range(0,int(num)):
res = 0
smax,aud = [str(l) for l in f.readline().split()]
clap = int(aud[0])
for j,nSi in enumerate([int(x) for x in aud]):
@LXZE
LXZE / codejam4.java
Created April 13, 2014 23:00
Problem D - Deceitful war
import java.util.*;
import java.io.*;
public class codejam4{
public static void main(String[] args) throws IOException{
Scanner sc = new Scanner(new FileReader("D-large.in"));
BufferedWriter write = new BufferedWriter(new FileWriter("output.txt"));
int caseN = sc.nextInt();
sc.nextLine();
@LXZE
LXZE / codejam2.java
Created April 13, 2014 22:55
Problem B - Cookie Clicker
import java.util.*;
import java.io.*;
import java.text.*;
public class codejam2{
public static void main(String[] args) throws IOException{
Scanner sc = new Scanner(new FileReader("B-large.in"));
BufferedWriter write = new BufferedWriter(new FileWriter("output.txt"));
int caseN = sc.nextInt();
sc.nextLine();
String[] allCase = new String[caseN];