Skip to content

Instantly share code, notes, and snippets.

View kunishi's full-sized avatar

Takeo Kunishima kunishi

View GitHub Profile
@kunishi
kunishi / japan_a.c
Created January 30, 2014 03:59
ICPC2007
#include <stdio.h>
#include <stdlib.h>
int main()
{
int number;
int i;
int max, min;
int score;
int count;
@kunishi
kunishi / A.c
Created January 30, 2014 03:57
ICPC2006
#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 / AtomFormatter.java
Created January 29, 2014 10:44
AtomParser
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@kunishi
kunishi / Makefile
Created January 29, 2014 10:41
Opu Experiments 1b (C version), 4-2
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
@kunishi
kunishi / Makefile
Created January 29, 2014 10:40
Opu Experiments IB (C version), 1
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
@kunishi
kunishi / Makefile
Created January 29, 2014 10:39
Opu Experiments IB (C version), 1-6
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
@kunishi
kunishi / Makefile
Created January 29, 2014 10:37
Opu Experiments IB (C version), 1-4
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
@kunishi
kunishi / A.java
Created January 29, 2014 10:28
ICPC 2005, Tokyo Region, Problem A
package jp.ac.oka_pu.icpc2005tokyo;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class A {
class Prime {
@kunishi
kunishi / 2009_asia_b.sml
Created January 29, 2014 10:27
ICPC 2009 Asia Region, Problem B
fun subst src dst s =
let
open Substring
fun subst_sub src dst ss =
let
val (pref, suff) = position src ss
in
if isEmpty suff (* not found *)
then [pref]
else pref :: (full dst) ::
@kunishi
kunishi / 2009_asia_a.sml
Created January 29, 2014 10:27
ICPC 2009 Asia Region, Problem A
fun sort _ nil = nil
| sort f (xl as x::xs) = sort f (List.filter (fn y => f y x = LESS) xs)
@ (List.filter (fn y => f y x = EQUAL) xl)
@ sort f (List.filter (fn y => f y x = GREATER) xs);
fun compare x y =
if x < y then LESS
else if x > y then GREATER
else EQUAL;