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: October 2009
Poj Solution 1185
http://poj.org/problem?id=1185 //* @author: /*��Ŀ������һ��n*m�ķ����з����ڱ�Ҫ�����ڣ���û���ڱ�������ܷŶ��� *��ʼ��Ϊû���뵽�õķ�������������һ�Σ�tle… *֪���й���״̬ѹ����㷨���ɲ�̫�����һֱ����û����쿴��һ��״̬ѹ��ģ��㷨 *������д����4���������ڣ�c.. *״̬ѹ����λ4��ʾ״̬������λ�����ʡʱ�䣨���Ǻ�����ᣩ *ö��״̬������״̬ת�ƴӶ�õ����Ž⣬��Ϊ״̬ѹ��DP… */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; class cin { static BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static int leave=0; static int nextInt()throws IOException { return Integer.parseInt(next()); } … Continue reading
Posted in poj
Leave a comment
Poj Solution 1183
http://poj.org/problem?id=1183 //* @author popop0p0popo import java.util.*; import java.io.*; public class Main{ public static void main(String[] args){ Scanner scanner=new Scanner(new BufferedReader(new InputStreamReader(System.in))); long a=scanner.nextInt(); long m=1; for (long i=a;i>=1 ;i– ){ if ((a*a+1)%i==0){ m=i; break; } } System.out.println(2*a+m+(a*a+1)/m); } }
Posted in poj
Leave a comment
Poj Solution 1182
http://poj.org/problem?id=1182 import java.io.*; public class Main { public static void main(String[] args) throws IOException { Main poj = new Main(); BufferedReader read = new BufferedReader(new InputStreamReader( System.in)); String[] tm = read.readLine().split(" "); int N = new Integer(tm[0]); int K = … Continue reading
Posted in poj
Leave a comment
Poj Solution 1178
http://poj.org/problem?id=1178 //* @author: import java.util.*; public class Main { static int dis[][][][]=new int[8][8][8][8]; static int x[]=new int[64],y[]=new int[64], n; static void floyd() { int i1, i2, i3, j1, j2, j3, t; for( i1=0; i1< 8; i1++ ) for( j1=0; j1< … Continue reading
Posted in poj
Leave a comment
Poj Solution 1171
http://poj.org/problem?id=1171 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; public class Main { static final int N = 1000+10; static int top,ans; static String opt = new String(); static String str[] =new String[N]; static int score[]={2,5,4,4,1,6,5,5,1,7,6,3,5,2,3,5,7,2,1,2,4,6,6,7,5,7}; public static void main(String[]args)throws Exception{ … Continue reading
Posted in poj
Leave a comment
Poj Solution 1166
http://poj.org/problem?id=1166 /* @author: */ import java.util.Scanner; public class Main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int arr[]=new int[9]; int ans[]=new int[9]; int i=0; for(i=0;i< 9;i++) arr[i]=sc.nextInt(); int a1,a2,a3,a4,a5,a6,a7,a8,a9,cnt; int u[]=new int[9]; int min=100; for(a1=0;a1< 4;a1++) for(a2=0;a2< 4;a2++) for(a3=0;a3< … Continue reading
Posted in poj
Leave a comment
Poj Solution 1165
http://poj.org/problem?id=1165 //* @author: import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int sum=in.nextInt(); int lefttop=in.nextInt(); cnt=new int[11][11][11][11][11]; for (int i = 0; i < cnt.length; i++) { for (int j = … Continue reading
Posted in poj
Leave a comment
Poj Solution 1164
http://poj.org/problem?id=1164 #include<iostream> #include<string> #include<cmath> #include<algorithm> using namespace std; int mat[55][55]; int num; bool vist[55][55]; void DFS(int x,int y) { num++; vist[x][y]=true; if(mat[x][y]%2==0) //搜索该位置的西方 { if(!vist[x][y-1]) DFS(x,y-1); } mat[x][y]/=2; if(mat[x][y]%2==0) //搜索该位置的北方 { if(!vist[x-1][y]) DFS(x-1,y); } mat[x][y]/=2; if(mat[x][y]%2==0) //搜索该位置的东方 { if(!vist[x][y+1]) DFS(x,y+1); … Continue reading
Posted in poj
Leave a comment
Poj Solution 1160
http://poj.org/problem?id=1160 /* @author: */ import java.util.Scanner; import java.util.Arrays; public class Main{ static int num[]=new int[302]; static int s[][]=new int[302][302]; static void cost(int n){ int i,j,k; for(i=1;i< n;i++){ for(k=i+1; k <= n; k ++){ int mid=(i+k)/2; for(j=i;j< mid;j++) s[i][k]+=num[mid]-num[j]; for(j=mid+1;j<=k;j++) s[i][k]+=num[j]-num[mid]; … Continue reading
Posted in poj
Leave a comment
Poj Solution 1159
http://poj.org/problem?id=1159 import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception{ BufferedReader in = new BufferedReader(new InputStreamReader (System.in)); int total = Integer.parseInt(in.readLine()); String string = in.readLine(); System.out.println(total-LCS(string,new StringBuffer(string).reverse().toString())); } //����}��string��lcs�ij��� public static int LCS(String str1,String … Continue reading
Posted in poj
Leave a comment
Poj Solution 1158
http://poj.org/problem?id=1158 #include <stdio.h> #include <memory.h> #include <vector> #include <queue> using namespace std; int n, begin, end; int b[300], p[300], sum[300]; int r[300]; typedef pair<int,int> p_i; bool s[300][30000]; vector< p_i > e[300]; struct cmp { bool operator()( const p_i &a, const … Continue reading
Posted in poj
Leave a comment
Poj Solution 1157
http://poj.org/problem?id=1157 //* @author: 82638882@163.com import java.io.*; public class Main { static boolean[][] p; static int sz; static String[] ss; public static void main(String[] args) throws IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); String[] ss=in.readLine().split(" "); int a=Integer.parseInt(ss[0]); int b=Integer.parseInt(ss[1]); … Continue reading
Posted in poj
Leave a comment
Poj Solution 1155
http://poj.org/problem?id=1155 /* @author: */ import java.util.*; import java.util.Scanner; public class Main{ static int[][] dp; static int[] offspring; static int[] vert; static int[] parent; static int[] leaf; static int n,k; public static void main(String[] args) { Scanner cin=new Scanner(System.in); n=cin.nextInt(); leaf=new … Continue reading
Posted in poj
Leave a comment