Skip to content

Instantly share code, notes, and snippets.

View kunishi's full-sized avatar

Takeo Kunishima kunishi

View GitHub Profile
@kunishi
kunishi / gist:3031628
Created July 2, 2012 07:10
ACM International Collegiate Programming Contest, Japan Domestic, 2006, Problem A
#include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
int main(int argc, char *argv[])
{
FILE *in;
int a, d, n;
@kunishi
kunishi / gist:3031635
Created July 2, 2012 07:13
ACM International Collegiate Programming Contest, Japan Domestic, 2006, Problem B
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void perm(char *, char *, int);
int main(int argc, char *argv[])
{
FILE *in;
int data_num;
@kunishi
kunishi / gist:3031637
Created July 2, 2012 07:15
ACM International Collegiate Programming Contest, Japan Domestic, 2006, Problem E
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
FILE *in;
char stack[100];
char str[100];
int n;
int c;
@kunishi
kunishi / gist:3031641
Created July 2, 2012 07:16
ACM International Collegiate Programming Contest, Japan Domestic, 2007, Problem A
#include <stdio.h>
#include <stdlib.h>
int main()
{
int number;
int i;
int max, min;
int score;
int count;
@kunishi
kunishi / gist:3031655
Created July 2, 2012 07:21
ACM International Collegiate Programming Contest, Japan Domestic, 2007, Problem C
#include <stdio.h>
#include <stdlib.h>
struct cake {
int w;
int d;
struct cake *next;
struct cake *prev;
};
@kunishi
kunishi / gist:3031663
Created July 2, 2012 07:24
ACM International Collegiate Programming Contest, Japan Domestic, 2004, Problem A
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
/*
* A.java
*
* Created on 2005/06/09, 22:57
*
@kunishi
kunishi / gist:3031665
Created July 2, 2012 07:25
ACM International Collegiate Programming Contest, Japan Domestic, 2004, Problem B
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.ListIterator;
/*
* B.java
*
* Created on 2005/06/10, 2:05
@kunishi
kunishi / gist:3031704
Created July 2, 2012 07:38
ACM International Collegiate Programming Contest, Japan Domestic, 2004, Problem C
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
/*
* C.java
*
* Created on 2005/06/13, 12:25
*
@kunishi
kunishi / gist:3031737
Created July 2, 2012 07:47
factorial
fun factorial n =
let
fun fact1 1 result = result
| fact1 n result = fact1 (n-1) (n * result)
in
fact1 n 1
end;
@kunishi
kunishi / gist:3031741
Created July 2, 2012 07:48
interleave
fun interleave n nil = [[n]]
| interleave n (L as x::xs) = (n::L) :: map (fn L => x::L) (interleave n xs);