Skip to content

Instantly share code, notes, and snippets.

View johncip's full-sized avatar

John Cipriano johncip

View GitHub Profile
@johncip
johncip / uva-fast-io
Created May 25, 2014 08:27
Contest problem fast I/O template
/*
* Title
*/
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
@johncip
johncip / 264.java
Last active February 17, 2016 06:02
Count on Cantor
/*
* 264 - Count on Cantor
*
* Given an input value N, print the Nth term in Cantor's enumeration.
*
* There may be a simpler closed form of this. However, what strikes me as
* possible right now is: we figure out what diagonal n is on, which gives us
* the beginning of that diagonal (1/2, 3/1, 1/4, 5/1, etc.). Then, we adjust
* the numerator and denominator based on the distance from the first term in
* the diagonal and the direction it takes (up-right for odd, down-left for