Monthly Archives: May 2009

Poj Solution 1062

http://poj.org/problem?id=1062 //���ձ��˵�˼���õ�,֮ǰ���Ǻ��˽�dijkstra������������Щ��� //1,����ǰδ�������·�ķ��Ҫ��ľ�����̽���������·; //2,�������뵱ǰ����Ľ���й�j����δ���������·�Ľ����̾�����и��¡� //ͼ������һ������С�����ĵľ����㷨Prim�㷨��Dij��̼������ƣ�����̰��˼�롣 //ֻ��һ���ǶԶ����ѡ������һ���ǶԱߵ�ѡ�� import java.util.*; public class Main { public static int[][] e; public static int[] dis; public static int[] used; public static int[] level; public static int n,m; public static void main(String[] args){ Scanner cin = … Continue reading

Posted in poj | Leave a comment

Poj Solution 1061

http://poj.org/problem?id=1061 import java.util.Scanner; public class Main { static long x0, y0; public static void main(String[] args) { Scanner scan = new Scanner(System.in); long x = scan.nextInt(); long y = scan.nextInt(); long m = scan.nextInt(); long n = scan.nextInt(); long L … Continue reading

Posted in poj | Leave a comment

Poj Solution 1058

http://poj.org/problem?id=1058 //* @author: import java.util.*; public class Main{ String result[][]; char c[]={‘A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’,’I’,’J’,’K’,’L’,’M’,’N’,’O’,’P’}; boolean used[]; public Main(String result[][]){ this.result=result; } public static void main(String args[]){ Scanner sc=new Scanner(System.in); while(true){ String result[][]=new String[5][4]; for(int i=0;i< 5;i++) for(int j=0;j< 4;j++){ if(i>=3) result[i][j]=""; else … Continue reading

Posted in poj | Leave a comment

Poj Solution 1057

http://poj.org/problem?id=1057 /* @author:����acmilan_fan@yahoo.cn */ import java.io.*; public class Main { public static void main(String[] args) throws Exception{ //System.setIn(new FileInputStream(new File("E:\in.txt"))); //System.setOut(new PrintStream(new File("E:\out.txt"))); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s; Node root=new Node("ROOT",null); Node curr=root; Node t,n; int count=1; … Continue reading

Posted in poj | Leave a comment

Poj Solution 1056

http://poj.org/problem?id=1056 //* @author 洪晓鹏&lt;hongxp11@163.com&gt; import java.util.ArrayList; import java.util.Scanner; public class Main { /** * @param args */ public static boolean isPrefix(String a, String b) { int len = a.length() > b.length() ? b.length() : a.length(); if (a.substring(0, len).equals(b.substring(0, len))) return … Continue reading

Posted in poj | Leave a comment

Poj Solution 1054

http://poj.org/problem?id=1054 import java.util.Arrays; import java.util.Scanner; public class Main { class Point implements Comparable { int row; int col; public Point(int x, int y) { this.row = x; this.col = y; } public int compareTo(Object o) { int result = 0; … Continue reading

Posted in poj | Leave a comment

Poj Solution 1051

http://poj.org/problem?id=1051 //* @author import java.io.*; import java.util.*; public class Main { static HashMap< String,String> codeMap = new HashMap< String,String>(); static HashMap< String,String> ref = new HashMap< String,String>(); public static void main(String[] args) throws Exception { initMap(); readFile(); } static void … Continue reading

Posted in poj | Leave a comment

Poj Solution 1050

http://poj.org/problem?id=1050 import java.util.Scanner; public class Main { int[][] a; int l; int max = Integer.MIN_VALUE; int t; int t1; int t2[]; public Main() { Scanner scan = new Scanner(System.in); l = scan.nextInt(); a = new int[l][l]; for (int i = … Continue reading

Posted in poj | Leave a comment

Poj Solution 1047

http://poj.org/problem?id=1047 import java.util.*; import java.math.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); BigInteger b,c,d; String str,str1,str2,str3; int i,len; while(cin.hasNext()) { str = cin.next(); b = new BigInteger(str); len=str.length()+1; char []kids = new … Continue reading

Posted in poj | Leave a comment