Skip to content

Instantly share code, notes, and snippets.

//
// It's not a Bug, It's a Feature! (Java Version)
// Christopher Vo (cvo1 at cs.gmu.edu)
//
public class Main {
private static final class Patch {
private int cost = 0, rp = 0, rm = 0, pp = 0, pm = 0;
}
private static final class Node implements Comparable<Node> {
private int state = 0, cost = 0;
//
// Switching Channels
// Uses exhaustive search through all possible programs
// This version does not use next_permutation!
// Christopher Vo (cvo1 at cs.gmu.edu)
//
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
@vo
vo / permute-stl.cpp
Created April 1, 2010 07:43
getting permutations
//
// An example of how to generate permutations
// using STL algorithms library
//
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
const int N = 8;
@vo
vo / p406-ian.c
Created April 10, 2010 02:44
Prime Cuts (and computing primes)
#include <stdio.h>
const static int const prime_list[170] = { 1, 2, 3, 5, 7, 11, 13, 17, 19, 23,
29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103,
107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181,
191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269,
271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359,
367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449,
457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557,
563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643,
; A scene called "Bars" by Christopher Vo
(scene "bars"
(author "Christopher Vo")
; World / global properties go here.
; e.g. fog, ambient light, background, skybox, and gravity
(world
(gravity 9.8)
(colorAmbient 0.1 0.1 0.1)
(colorBackground 0.2 0.2 0.2))
#!/bin/bash
sudo service network-manager stop
sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode ad-hoc essid $1 channel 4
sudo ifconfig wlan0 172.17.116.106 netmask 255.255.255.0 up
@vo
vo / a.cpp
Created September 11, 2010 02:35
// Problem A: A Contesting Decision
// Author: Christopher Vo
#include <iostream>
#include <algorithm>
using namespace std;
struct team
{
string name;
@vo
vo / h.cpp
Created September 11, 2010 03:25
// Problem H: Reverse Roman Notation
// Author: Christopher Vo
#include <iostream>
#include <stack>
#include <string>
using namespace std;
stack<int> sys;
// exceptions
@vo
vo / C.java
Created September 11, 2010 05:41
// Problem C: Choose Your Words Carefully
// Author: Christopher Vo
import java.util.*;
public class C {
public static void main(String args[]) {
HashMap<String, Integer> map = new HashMap<String, Integer>();
Scanner sc = new Scanner(System.in).useDelimiter("[^a-zA-Z0-9]+");
while (sc.hasNext()) {
@vo
vo / e.cpp
Created September 12, 2010 08:10
// Problem E: Helping Florida
// Author: Christopher Vo
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <sstream>
#include <algorithm>
using namespace std;