Code Jam 2009 Java

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Code Jam 2009 Java as PDF for free.

More details

  • Words: 410
  • Pages: 2
Archivo: /home/misan/gcj/2009/C1/Welcome.java

Página 1 de 2

import java.util.*; import java.util.regex.*; class Alien { public static void main(String[] args) { Scanner in = new Scanner(System.in); int L = in.nextInt(); int D = in.nextInt(); String[] dictionary = new String[D]; int N = in.nextInt(); in.nextLine(); for(int i=0; i=0) if(map[x][y-1]<min) {min=map[x][y-1]; x1=x; y1=y-1; n=1;} // NORTH if(x-1>=0) if(map[x-1][y]<min) {min=map[x-1][y]; x1=x-1; y1=y; n=2;} // WEST if(x+1<W) if(map[x+1][y]<min) {min=map[x+1][y]; x1=x+1; y1=y; n=4;} // EAST if(y+1-1) next[x+y*W]=x1+y1*W; //next cell candidate, if any ... (or it's a sink) } for(int j=0;j<W*H; j++) if(out[j]<'a') { // not yet marked Stack l = new Stack(); int n = j; do {l.push(n); n=next[n]; } while(n!=-1); if(out[l.peek()]<'a') {for(int k : l) out[k]=basin; basin++;} // new basin, new color else {char c=out[l.peek()]; for(int k : l) out[k]=c;} // existing basin, same color } for(int j=0;j
Archivo: /home/misan/gcj/2009/C1/Welcome.java public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); in.nextLine(); for(int n=0; n
Página 2 de 2

Related Documents

Code Jam 2009 Java
May 2020 5
Java Pro Code
May 2020 10
Java Script Code
May 2020 14
Jam
October 2019 46