14.01.2013 Views

Soluciones y Explicación de los problemas ACM ... - ICPC Bolivia

Soluciones y Explicación de los problemas ACM ... - ICPC Bolivia

Soluciones y Explicación de los problemas ACM ... - ICPC Bolivia

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Explicaciones a <strong>los</strong> <strong>problemas</strong> South American Regionals 2008 56<br />

Programa Java que soluciona el problema<br />

import java.util.*;<br />

class tsp {<br />

static final int MAX_N = 100;<br />

static final int MAX_M = 500;<br />

static int M, N;<br />

static int[][] edge = new int[MAX_M + 1][2];<br />

static int[][] inc = new int[MAX_N + 1][MAX_M];<br />

static int[] d = new int[MAX_N + 1];<br />

static int forbid<strong>de</strong>n_edge, n_visited;<br />

static int[] visited = new int[MAX_N + 1];<br />

public static void main(String[] args) {<br />

Scanner in = new Scanner(System.in);<br />

int K, e, v, n_imp, j, res;<br />

for (;;) {<br />

M = in.nextInt();<br />

N = in.nextInt();<br />

if (M == 0) break;<br />

Arrays.fill(d, 0);<br />

for(int a=0;a

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!