Skip to content

Instantly share code, notes, and snippets.

View kunishi's full-sized avatar

Takeo Kunishima kunishi

View GitHub Profile
@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 / 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;
size(480, 120);
rect(160, 30, 260, 20);
ellipse(140, 0, 190, 190);
upstream app {
server unix:/usr/local/nginx/html/apps/service/shared/tmp/sockets/unicorn.app.sock fail_timeout=0;
}
server {
listen 80;
server_name service.dbsj.org;
client_max_body_size 4G;
root /usr/local/nginx/html/apps/service/current/public;
@kunishi
kunishi / build.gradle
Created March 13, 2015 06:40
build.gradle on top of the project.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
@kunishi
kunishi / build.gradle
Created March 13, 2015 06:42
build.grade under time_circle.
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.time_circle"
minSdkVersion 17
targetSdkVersion 17
@kunishi
kunishi / TestDialogFragment.java
Created March 16, 2015 08:01
TestDialogFragment.java, fix version.
package com.example.time_circle;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@kunishi
kunishi / bintree.sml
Created July 2, 2012 03:00
Binary Tree, a simplified version of the codes in 'Elements of ML Programming (ML97 Edition)'
datatype 'label btree =
Empty |
Node of 'label * 'label btree * 'label btree;
fun lower(nil) = nil
| lower(c::cs) = (Char.toLower c)::lower(cs);
fun lt(x, y) =
implode(lower(explode(x))) < implode(lower(explode(y)));
@kunishi
kunishi / gist:3030777
Created July 2, 2012 03:13
ACM International Collegiate Programming Contest, Asia Regional (Tokyo), 2007, Problem A
fun remove_a_stone vec i =
let
open VectorSlice
val size = Vector.length vec - 1
val newvec =
if i = 0 then vector (slice (vec, 1, SOME size))
else if i = size then vector (slice (vec, 0, SOME size))
else concat [slice (vec, 0, SOME i),
slice (vec, i+1, SOME (size-i))]
in
@kunishi
kunishi / gist:3030781
Created July 2, 2012 03:14
ACM International Collegiate Programming Contest, Asia Regional (Tokyo), 2007, Problem B
exception NotFoundException
fun get_primes n =
let
val l = List.tabulate (n, fn n => n + 2)
fun get_primes_sub nil result = result
| get_primes_sub (x::xs) result =
get_primes_sub (List.filter (fn n => n mod x <> 0) xs) (x::result)
in
List.rev (get_primes_sub l nil)