Skip to content

Instantly share code, notes, and snippets.

View evandrix's full-sized avatar
💭
offline

evandrix evandrix

💭
offline
View GitHub Profile
@evandrix
evandrix / LICENSE.txt
Created February 14, 2012 21:17 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Consider two horizontal lines and a set of N trapezoids. A trapezoid T[i]
between these lines has two vertices situated on the upper line and the other
two vertices on the lower line. We will denote by a[i], b[i], c[i] and d[i] the
upper left, upper right, lower left and respectively lower right vertices of
the trapezoid T[i]. Assume that no two trapezoids share a common vertex
(meaning that all a [i] and b [i] coordinates on the upper line are different,
and the same holds for the bottom line and coordinates c [i] and d [i]). A
trapezoid set is called disconnected if one can separate the trapezoids in two
or more groups such that no two trapezoids from different groups intersect.
Determine the smallest number of trapezoids to remove, such that the remaining
@evandrix
evandrix / 2.html
Created February 12, 2012 02:58
Apply to Embedly - Challenge
<html><head><title>Embedly Apply Document</title></head><body><span>laborum id pork loin</span><article><p>ncetta. Velit ribeye shoulder, et ball tip venison incididunt ut
pork chop exercitation spare ribs f<div><div><div><div><span>lit ribeye shoulder,</span><div><div><p>owl, turducken flank
ball tip adipisicing short ribs ham hock anim. Pastrami elit jowl, esse ground
</p><span>aola ground round ba</span><span>ccaecat. Adipisicing</span><div></div><div></div></div><span> aliqua occaecat. Ad</span><div><span>aboris
jerky ham sin</span><span>nt laborum id pork l</span><div></div><div></div><div></div></div><span>boris
jerky ham sint</span><span>ound round ball tip
</span></div><p> mollit laboris
jerky ham sint nisi turkey aliqua. Pig non velit pork jowl, turducken flank
ball tip<div><span>t jowl, esse ground
</span><span>e tongue short ribs </span><p> t-bone excepteur magna ullamco sausage
You are given a network with N cities and M bidirectional roads connecting
these cities. The first K cities are important. You need to remove the minimum
number of roads such that in the remaining network there are no cycles that
contain important cities. A cycle is a sequence of at least three different
cities such that each pair of neighbouring cities are connected by a road and
the first and the last city in the sequence are also connected by a road.
Input
The first line contains the number of test cases T.
@evandrix
evandrix / A.cpp
Created January 25, 2012 03:01
Competitive Programming links
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
@evandrix
evandrix / uva291.java
Created January 25, 2012 03:00
UVa Online Judge Practice
import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.io.*;
import java.util.*;
/**
* 291 - The House Of Santa Claus
*/
class Main

== Expressing integers using four nines

What non-negative integers can you write as expressions containing exactly four occurrences the number 9, and any of the binary operators *, /, %, +, -, prefix negations, and any number of matching pairs of parentheses you care to use?

The program should accept an upper limit N as a command-line argument. It should then print all integers 0..N in increasing order, along with an expression with four nines, if any such was found.

@evandrix
evandrix / anagram.c
Created November 25, 2011 02:30
Anagram finder
/******************************************************************************
* This function is a code snippet. It can be freely used and distributed.
* Author: irfan[dot]hamid[at]gmail[at]com
*
* This function takes two ASCII strings in C syntax (null-terminated
* character arrays) and determines whether they are anagrams or not.
*
* Implementation notes:
* The function contains a histogram that stores the frequency of each
* character it encounters in the first string. For each character of the
@evandrix
evandrix / extreme_startup_client.rb
Created November 22, 2011 11:43
Extreme Startup submission - SWEng tutorial Mon 21Nov11
require 'sinatra'
require 'logger'
log = Logger.new(STDOUT)
log.level = Logger::DEBUG
get '/' do
if params[:q]
log.debug(params[:q])
sz_q = params[:q].split(": ")[1]
@evandrix
evandrix / DimensionCalculator.java
Created October 17, 2011 22:11
Android: Dynamic screen sizes
/**
* Sample class from Pulse
*
* Class to store and provide useful dimensions
*/
public class DimensionCalculator {
private static DimensionCalculator mInstance = null;
private int mScreenWidth;
private int mTileWidth;