Meta
-
Recent Posts
Recent Comments
Archives
- May 2024
- April 2023
- February 2023
- January 2023
- December 2022
- November 2022
- September 2022
- June 2022
- July 2021
- January 2021
- February 2020
- September 2019
- March 2018
- February 2018
- August 2016
- July 2016
- June 2016
- May 2016
- April 2016
- March 2016
- February 2016
- January 2016
- December 2015
- November 2015
- October 2015
- September 2015
- August 2015
- July 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- November 2014
- October 2014
- September 2014
- August 2014
- July 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- August 2013
- July 2013
- June 2013
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
Categories
Monthly Archives: August 2009
Poj Solution 1132
http://poj.org/problem?id=1132 #include<stdio.h> #include<string.h> #include<math.h> #include<stdlib.h> #define NMAX 33 #define INF 1000000001 int xp[4]={0,1,0,-1},yp[4]={1,0,-1,0}; int dx[4]={0,0,-1,-1},dy[4]={0,-1,-1,0}; int stx,sty; int map[NMAX][NMAX]; char in[NMAX*NMAX]; int set(char t) { switch(t) { case ‘N’:return 0; case ‘E’:return 1; case ‘S’:return 2; case ‘W’:return 3; } … Continue reading
Posted in poj
Leave a comment
Poj Solution 1131
http://poj.org/problem?id=1131 import java.io.*; import java.util.*; import java.math.*; public class Main{ public static void main(String[] args){ Scanner cin=new Scanner(System.in); BigDecimal temp,sum,ans,num; String str; int i,len; while(cin.hasNext()){ str=cin.next(); len=str.length(); temp=BigDecimal.valueOf(8.0); sum=BigDecimal.ONE; ans=BigDecimal.ZERO; for(i=2;i< len;i++) { int val=str.charAt(i)-‘0’; num=BigDecimal.valueOf(val); sum=sum.multiply(temp); ans=ans.add(num.divide(sum)); } System.out.printf("%s … Continue reading
Posted in poj
Leave a comment
Poj Solution 1129
http://poj.org/problem?id=1129 import java.util.*; import java.io.*; /* *����������ŵ7��䡣��һ������ͼ��Ϊÿ����������ɫ��Ҫ���������ڵĶ�����ɫ��ͬ�� * �����ٵ���ɫ���Ƕ���? *������������ɫ���?ֱ��ö����ɫ��+DFS������DFS�DZ�fö��ÿ�����ɫ���Ա��ҵ�һ����н⡣ */ public class Main{ public static int[][] g=new int[26][26]; public static int solve(int n){ int i,j,cnum; boolean tag=true; // �ޱ�ͼֻ��1ɫ���� for(i=0;i< n && tag;i++){ for(j=i+1;j< n && tag;j++){ if(g[i][j]==1) tag=false; … Continue reading
Posted in poj
Leave a comment
Poj Solution 1126
http://poj.org/problem?id=1126 import java.util.Scanner; public class Main { /** * @param args */ public static void main(String[] args) { Scanner s = new Scanner(System.in); String sentence = null; int count; char ch; while ((sentence = s.nextLine()) != null) { count = … Continue reading
Posted in poj
Leave a comment
Poj Solution 1122
http://poj.org/problem?id=1122 //* @author: 82638882@163.com import java.util.Arrays; import java.util.Scanner; public class Main { static final int Inf=9999999; public static void main(String[] args) { Scanner in=new Scanner(System.in); int a=in.nextInt(); int[][] p=new int[a][a]; for(int i=0;i< a;i++) for(int j=0;j< a;j++) p[i][j]=in.nextInt(); int loc =in.nextInt()-1; … Continue reading
Posted in poj
Leave a comment
Poj Solution 1120
http://poj.org/problem?id=1120 /* @author: */ import java.util.Scanner; import java.util.Arrays; public class Main{ int map[][]=new int[22][22]; int d[]=new int[16]; char code[]={‘.’,’!’,’X’,’#’}; int sum(int i,int j){ return map[i][j]+map[i-1][j]+map[i+1][j]+map[i][j-1]+map[i][j+1]; } public void doIt(){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); for(int i=0;i< 16;i++) d[i]=sc.nextInt(); for(int i=1;i<=20;i++) … Continue reading
Posted in poj
Leave a comment
Poj Solution 1119
http://poj.org/problem?id=1119 import java.io.BufferedReader; import java.io.InputStreamReader; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.HashMap; import java.util.Map; public class Main{ private static String convertString(String s) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i++) { if (s.charAt(i) >= … Continue reading
Posted in poj
Leave a comment
Poj Solution 1118
http://poj.org/problem?id=1118 //* @author: 82638882@163.com import java.util.*; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); while(true) { int a=in.nextInt(); if(a==0)break; int[] arrx=new int[a]; int[] arry=new int[a]; for(int i=0;i< a;i++) { arrx[i]=in.nextInt(); arry[i]=in.nextInt(); } int max=0; for(int … Continue reading
Posted in poj
Leave a comment
Poj Solution 1113
http://poj.org/problem?id=1113 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { class Point { int x; int y; public Point(int x, int y) { this.x = x; this.y = y; } } public static void main(String[] args) throws IOException { … Continue reading
Posted in poj
Leave a comment
Poj Solution 1112
http://poj.org/problem?id=1112 #include <vector> #include <algorithm> #include <stdio.h> #include <memory.h> #include <math.h> using namespace std; vector<int> unknow[100]; vector< pair<int,int> > s; int sign[100]; bool e[100][100]; int flag[110][110]; int a, b, an, bn; bool search( int k, int key ) { int … Continue reading
Posted in poj
Leave a comment
Poj Solution 1111
http://poj.org/problem?id=1111 //* @author: 82638882@163.com import java.io.*; class Main { static int cnt; static char[][] map; static int[][] bool; public static void main(String[] args) throws IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); while(true) { cnt=0; String[] ss=in.readLine().split(" "); int row=Integer.parseInt(ss[0]); … Continue reading
Posted in poj
Leave a comment
Poj Solution 1110
http://poj.org/problem?id=1110 #include "stdio.h" char map[80][10][80]; int n; int main( ) { int n, r, c, i, j, k, l, test = 0; while( scanf( "%d%d%d", &n, &r, &c ) == 3 ) { if( n == 0 ) break; for( … Continue reading
Posted in poj
Leave a comment