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: April 2010
Poj Solution 1383
http://poj.org/problem?id=1383 #include"stdio.h" #include"memory.h" char map[1100][1100]; bool sign[1100][1100]; int max,bx,by,n,m; void init_sign() { int i,j; for(i=0;i<n;i++) for(j=0;j<m;j++) sign[i][j]=0; } void init() { scanf("%d %d",&m,&n); for(int i=0;i<n;i++) scanf("%s",map[i]); } inline int inmap(int x,int y) { return x>=0&&y>=0&&x<n&&y<m; } const int dx[]={0,0,1,-1},dy[]={1,-1,0,0}; void … Continue reading
Posted in poj
Leave a comment
Poj Solution 1371
http://poj.org/problem?id=1371 #include <iostream> #include <algorithm> #include <memory.h> using namespace std; int x[200], y[200], xn, yn, n, m; struct { int x1, x2, y1, y2; }ln[100]; char map[414][414]; bool init() { int i, j, l, r, u, d, k; cin >> … Continue reading
Posted in poj
Leave a comment
Poj Solution 1368
http://poj.org/problem?id=1368 #include<iostream> #include"memory.h" using namespace std; int set[3][3][3][3]; int map[7][7][4]; int n,m; int div(char c) {switch(c) {case ‘O’:return 0; case ‘F’:return 1; case ‘I’:return 2; default:return -1; } } void init() {int i,j,a[4];char c; memset(set,0,81*sizeof(int)); for(i=0;i<n*m;i++) {for(j=0;j<4;j++) {cin>>c;a[j]=div(c);} set[a[0]][a[1]][a[2]][a[3]]++; } … Continue reading
Posted in poj
Leave a comment
Poj Solution 1366
http://poj.org/problem?id=1366 //* @author: <strong>Yeming Hu</strong>"cslittleye@gmail.com" import java.util.*; import java.io.*; public class Main { public static BufferedInputStream bis; public static StringBuilder str; public static char[][] rules; public static StringBuilder[] words; public static int k; public static void main(String[] args) throws Exception { … Continue reading
Posted in poj
Leave a comment
Poj Solution 1365
http://poj.org/problem?id=1365 import java.util.*; import java.math.*; public class Main { /** * @param args */ static int pp; static int[] p = new int[30000]; static int[] w = new int[30000]; static boolean[] q = new boolean[35000]; static void init() { int … Continue reading
Posted in poj
Leave a comment
Poj Solution 1363
http://poj.org/problem?id=1363 import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int in[]=new int[1001]; int out[]=new int[1001]; int stack[]=new int[1001]; int n; int i,j; for(i=0;i< 1001;i++) in[i]=i+1; while(sc.hasNext()) { n=sc.nextInt(); if(n==0) break; while(true) { … Continue reading
Posted in poj
Leave a comment
Poj Solution 1362
http://poj.org/problem?id=1362 //* @author: <strong>Yeming Hu</strong>"cslittleye@gmail.com" import java.util.*; public class Main { public static final int max = 30; public static void main(String[] args) { int[] weights = new int[max]; int p = 2; for(int i = 0; i < max; i++) … Continue reading
Posted in poj
Leave a comment
Poj Solution 1354
http://poj.org/problem?id=1354 import java.io.BufferedInputStream; import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(new BufferedInputStream(System.in)); while (scan.hasNext()) { int n = scan.nextInt(); if (n == -1) { break; } BigDecimal nn = … Continue reading
Posted in poj
Leave a comment
Poj Solution 1353
http://poj.org/problem?id=1353 //* @author: import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int a[]=new int[200],b[]=new int[200]; int n,m,k; while(sc.hasNext()) { String s=sc.nextLine(); Scanner scan=new Scanner(s); scan.useDelimiter(","); n=scan.nextInt(); if(n==-1) break; m=scan.nextInt(); k=scan.nextInt(); for (int i=1;i<=n;i++) { if … Continue reading
Posted in poj
Leave a comment
Poj Solution 1351
http://poj.org/problem?id=1351 /* @author:zeropinzuo */ import java.io.*; import java.util.*; public class Main{ static Scanner cin; static long[] f,g; public static void main(String args[]){ cin = new Scanner(System.in); f = new long[17]; g = new long[17]; g[1]=4; g[2]=14; for(int i=3;i< 17;i++) g[i]=3*g[i-1]+2*g[i-2]; … Continue reading
Posted in poj
Leave a comment
Poj Solution 1350
http://poj.org/problem?id=1350 //* @author: <strong>Yeming Hu</strong>"cslittleye@gmail.com" import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true) { String num = sc.next(); if(num.equals("-1")) { break; } System.out.println("N="+num+":"); if(num.length()!=4||(num.charAt(0)==num.charAt(1)&& num.charAt(1)==num.charAt(2)&& num.charAt(2)==num.charAt(3))) { System.out.println("No!!"); }else { int … Continue reading
Posted in poj
Leave a comment
Poj Solution 1344
http://poj.org/problem?id=1344 //* @author: import java.util.*; public class Main { static int value[][]=new int[50][50]; static int ans,n; static void calc() { int i, j, temp, k, s; for( k=0; k< n-2; k++ ) { s = 10000000; for( i = k+1; … Continue reading
Posted in poj
Leave a comment
Poj Solution 1338
http://poj.org/problem?id=1338 //* @author mekarlos@gmail.com import java.util.Scanner; import java.util.Vector; public class Main { public static void main(String[] args) { Scanner scan=new Scanner(System.in); Vector< Long> v=new Vector< Long>(); v.add(new Long(1)); int i=0,j=0,k=0; while(v.size()< 1500){ v.add(Math.min(Math.min(v.get(i)*2, v.get(j)*3), v.get(k)*5)); if(v.get(v.size()-1).equals(v.get(v.size()-2))){v.remove(v.size()-1);} if(v.get(i)*2==v.get(v.size()-1))i++; else if(v.get(j)*3==v.get(v.size()-1))j++; else … Continue reading
Posted in poj
Leave a comment