Skip to content

Instantly share code, notes, and snippets.

View hiroshi-cl's full-sized avatar

Hiroshi YAMAGUCHI hiroshi-cl

  • Some company
  • Tokyo, Japan
View GitHub Profile
@hiroshi-cl
hiroshi-cl / DiceBuilder.java
Last active December 18, 2015 05:49
Dice library [Licence: NYSL Version 0.9982]
public class DiceBuilder {
private final boolean[][] dat = new boolean[6][4];
private final boolean[] visited = new boolean[6];
private static final String[] map = { "4...", "0123", "5..." };
private int si = 1, sj = 0;
public boolean[][] build(boolean[][] in) {
dfs(new DiceState(), si, sj, in);
return dat;
}
@hiroshi-cl
hiroshi-cl / Main.java
Created June 25, 2013 06:26
ACM-ICPC 模擬国内予選 2013 D: 沈みゆく島 [Licence: NYSL Version 0.9982]
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
private static final char[] nums = "0123456789".toCharArray();
private static final char[] opes = "+-*&^|".toCharArray();
private static final Map<String, Long> cache = new HashMap<>();
@hiroshi-cl
hiroshi-cl / Evaluator.java
Created June 25, 2013 06:36
ACM-ICPC 模擬国内予選 2013 E: 小野小町の編集合戦 [Licence: NYSL Version 0.9982]
public class Evaluator {
private static final int RADIX = 10;
private final Tokenizer tokenizer;
public Evaluator(String s) {
this.tokenizer = new Tokenizer(s);
}
public long evaluate() {
try {
@hiroshi-cl
hiroshi-cl / Main.java
Created June 25, 2013 06:46
ACM-ICPC 模擬地区予選 2012 G: Ancient Commemorative Monolith [Licence: NYSL Version 0.9982]
import java.util.*;
public class Main {
private static final Scanner sc = new Scanner(System.in);
public static void main(String... args) throws Exception {
while (sc.hasNext()) {
final int n = sc.nextInt();
final int m = sc.nextInt();
@hiroshi-cl
hiroshi-cl / Visualizer.java
Created June 25, 2013 06:50
ACM-ICPC 模擬地区予選 2012 G: Ancient Commemorative Monolith 入力ビジュアライザ [Licence: NYSL Version 0.9982]
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.image.*;
import javax.imageio.ImageIO;
public class Visualizer {
private static final int SCALE = 8;
private static final Scanner sc = new Scanner(System.in);
@hiroshi-cl
hiroshi-cl / Main.java
Created June 25, 2013 06:59
ACM-ICPC 模擬地区予選 2012 J: Ancient Scrolls [Licence: NYSL Version 0.9982
import java.util.*;
import static java.lang.Math.*;
public class Main {
private static final int n = 3; // future work n != 3
public static void main(String... args) {
final Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
final int l = sc.nextInt();
@hiroshi-cl
hiroshi-cl / Main.java
Created June 25, 2013 07:01
ACM-ICPC 模擬国内予選 2012 E: 敵の敵は味方 [Licence: NYSL Version 0.9982]
import java.util.*;
public class Main {
private static final Scanner sc = new Scanner(System.in);
public static void main(String... args) {
while (sc.hasNext()) {
final int N = sc.nextInt();
if (N == 0)
break;
@hiroshi-cl
hiroshi-cl / Main.java
Created June 25, 2013 07:13
2011年9月 夏合宿3日目 Problem G: Palindrome Generator [Licence: NYSL Version 0.9982]
import java.util.*;
import static java.lang.Math.*;
public class Main {
int n, m, l;
char[][] words;
boolean[][] map;
V[][][] vs;
public void run() {
@hiroshi-cl
hiroshi-cl / Main.java
Created June 25, 2013 07:15
2011年11月 模擬地区予選 Problem I: Mobile Network (解法2) [Licence: NYSL Version 0.9982]
import java.io.*;
import java.util.*;
public class Main {
static final int L = 50;
public void run() {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
@hiroshi-cl
hiroshi-cl / Main.java
Created June 25, 2013 07:17
2012年3月 冬コンテスト Problem A: Carpenter's Language [Licence: NYSL Version 0.9982]
import java.util.*;
public class Main {
public static void main(String...args) {
Scanner sc = new Scanner(System.in);
int q = sc.nextInt();
long d = 0;
for (int i = 0; i < q; i++) {
sc.next();
if (sc.next().charAt(0) == '(')
d += sc.nextInt();