Skip to content

Instantly share code, notes, and snippets.

John Cipriano johncip

View GitHub Profile
@johncip
johncip / uva-fast-io
Created May 25, 2014
Contest problem fast I/O template
View uva-fast-io
/*
* 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 Feb 17, 2016
Count on Cantor
View 264.java
/*
* 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
You can’t perform that action at this time.