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 2013
Poj Solution 2459
http://poj.org/problem?id=2459 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; public class Main { static final int N = 2000+10; static int DP[] = new int[N]; public static void main(String[]args) throws Exception{ int n,F1,F2,Day,i,sum,a,b,j; //Scanner cin = new Scanner(new FileInputStream("input.txt")); Scanner cin … Continue reading
Posted in poj
Leave a comment
Poj Solution 2458
http://poj.org/problem?id=2458 #include "stdio.h" char map[6][6]; bool sign[6][6]; int flag[6][6]; bool inline inmap( int x, int y ) { return 0<=x&&x<5&&0<=y&&y<5; } int dx[]={ 0,-1, 0, 1}; int dy[]={-1, 0, 1, 0}; int ans; int reach; int visit; void find( int … Continue reading
Posted in poj
Leave a comment
Poj Solution 2457
http://poj.org/problem?id=2457 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; public class Main { static final int N = 10000+10; static int meat[] = new int[N],pre[] = new int[N],n,K; static Vector Graph[] = new Vector[N]; static Queue que = new LinkedList<Integer>(); static … Continue reading
Posted in poj
Leave a comment
Poj Solution 2456
http://poj.org/problem?id=2456 #include <stdio.h> #include <algorithm> using namespace std; int pos[100000], n, cc; bool check( int l ) { int i, r, j; for( r=cc-1,i=0,j=1; j<n && r; j++ ) { if( pos[j]-pos[i]>=l ) { r–; i=j; } } return r … Continue reading
Posted in poj
Leave a comment
Poj Solution 2454
http://poj.org/problem?id=2454 #include"stdio.h" #include"memory.h" #include"algorithm" #include"stdlib.h" using namespace std; typedef pair<int,int> city; city c[180]; int n, k; void init() { int i; scanf( "%d", &n ); k = n; n *= 3; for( i=0; i<n; i++ ) { scanf( "%d", &c[i].first … Continue reading
Posted in poj
Leave a comment
Poj Solution 2453
http://poj.org/problem?id=2453 import java.util.Scanner; public class Main { /** * 获得一个Integer对应的二进制中1的个数 * @param i * @return sum */ public static int getSum(int i) { int sum = 0; while (i > 0) { i = i & (i – 1); ++sum; … Continue reading
Posted in poj
Leave a comment
Poj Solution 2452
http://poj.org/problem?id=2452 //* @author: import java.util.*; public class Main { static public void main( String [] str ) throws Exception{ Scanner sc = new Scanner(System.in); int i, j, h, ans; while(sc.hasNext()) { int n=sc.nextInt(); int s[]=new int[n]; for( i=0; i< n; … Continue reading
Posted in poj
Leave a comment
Poj Solution 2450
http://poj.org/problem?id=2450 //* @author: import java.util.*; import java.math.*; public class Main { static int gcd(int a,int b) { int c; while( (a%=b) != 0 ) { c=b; b=a; a=c; } return b; } static int a,b,c,d,n,m,p,q; static int t[] = new … Continue reading
Posted in poj
Leave a comment
Poj Solution 2447
http://poj.org/problem?id=2447 #include<stdlib.h> #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; typedef unsigned __int64 u64; #define MAX 30 #define MAXN 5 u64 len, dig, limit; u64 factor[MAXN]; u64 mod(u64 a, u64 b, u64 n){ if(!a)return 0; else return ( ((a&dig)*b)%n + (mod(a>>len,b,n)<<len)%n )%n; … Continue reading
Posted in poj
Leave a comment
Poj Solution 2446
http://poj.org/problem?id=2446 #include<iostream> #include<string> #include<cmath> #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; const int MAXN=1050; int link[MAXN]; int total; bool vist[33][33]; //用来标记那些位置有洞 bool usedif[MAXN]; bool mat[MAXN][MAXN]; bool Can(int t) { int i; for(i=0;i<total;i++) if(mat[t][i]&&!usedif[i]) { usedif[i]=true; if(link[i]==-1||Can(link[i])) { link[i]=t; return true; … Continue reading
Posted in poj
Leave a comment
Poj Solution 2445
http://poj.org/problem?id=2445 #include"stdio.h" #include"algorithm" using namespace std; int l[1500][1500],r[1500][1500],u[1500][1500],d[1500][1500],lu[1500][1500],rd[1500][1500]; int n; inline int max(int a,int b) { return a>b?a:b; } inline int min(int a,int b) { return a<b?a:b; } bool init() { int i,j,m,k,a,b; char c; if(scanf("%d",&n)!=1) return 0; scanf("%d",&m); for(i=0;i<n;i++) … Continue reading
Posted in poj
Leave a comment
Poj Solution 2443
http://poj.org/problem?id=2443 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; class Set{ void init(){ for(int i=0;i< 35;++i) state[i] = 0; } void get_int(int cnt){ int k = cnt/30; int posi = cnt%30; state[k]|=dir[posi]; } int dir[] = {1,1<<1,1<<2,1<<3,1<<4,1<<5,1<<6,1<<7,1<<8,1<<9,1<<10,1<<11,1<<12,1<<13,1<<14, 1<<15,1<<16,1<<17,1<<18,1<<19,1<<20,1<<21,1<<22,1<<23,1<<24,1<<25,1<<26,1<<27, 1<<28,1<<29,1<<30,1<<31}; int state[] … Continue reading
Posted in poj
Leave a comment
Poj Solution 2441
http://poj.org/problem?id=2441 //* @author: /* ����: N��ţ��M�������(barn)��ÿ��ţ���м����Լ�ϲ����barn��Ҫ��Ϊÿ��ţ����һ��barn�� ʹ��ÿ��ţ��ֵ���barn�����Լ�ϲ���ģ���ÿ��barn�v�ֻ������һ��ţ����Ϸ��ķ��䷽��������N,M<=20�� ����: ��һ����N��M(1<=N<=20, 1<=M<=20); ����4��N��: ��i�еĵ�һ�������ǵ�i��ţϲ����barn��,���������ǵ�i��ţϲ����barn���(1<=i<=N) ���: ���䷽�������� */ import java.util.*; public class Main { static final int N=20+2; static final int M=1<< 20+1; public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n, … Continue reading
Posted in poj
Leave a comment
Poj Solution 2440
http://poj.org/problem?id=2440 import java.util.Scanner; public class Main { public static int[][] org; public static int[][] m; public static int[][] f = new int[4][1]; public static void main(String[] args) { Scanner cin = new Scanner(System.in); while(cin.hasNext()) { int n = cin.nextInt(); if(test(n)) … Continue reading
Posted in poj
Leave a comment