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: March 2011
Poj Solution 1727
http://poj.org/problem?id=1727 #include "stdio.h" #include "algorithm" using namespace std; struct event{ int t, x; }p[100000]; bool cmp( event &a, event &b ) { return a.x+a.t < b.x+b.t; } int n, m; void input( ) { int i; scanf( "%d%d", &n, &m); … Continue reading
Posted in poj
Leave a comment
Poj Solution 1723
http://poj.org/problem?id=1723 import java.io.BufferedInputStream; import java.util.Arrays; import java.util.Scanner; public class Main { static int x[]; static int y[]; public static void main(String[] args) { Scanner scan = new Scanner(new BufferedInputStream(System.in)); if (scan.hasNext()) { int n = scan.nextInt(); x = new int[n]; … Continue reading
Posted in poj
Leave a comment
Poj Solution 1719
http://poj.org/problem?id=1719 #include <stdio.h> #include <memory.h> int e[1000][1000], en[1000], col[1000]; int match[1000]; bool sign1[1000], sign2[1000]; int flag[1000]; bool search( int a ) { int i, j; sign1[a] = true; for( i=0; i<en[a]; i++ ) { j = e[a][i]; if( !sign2[j] ) … Continue reading
Posted in poj
Leave a comment
Poj Solution 1716
http://poj.org/problem?id=1716 //* @author: 82638882@163.com import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); int a=Integer.parseInt(in.readLine()); int ans=2,i; my[] arr=new my[a]; String[] ss; for(i=0;i< a;i++) { ss=in.readLine().split(" … Continue reading
Posted in poj
Leave a comment
Poj Solution 1715
http://poj.org/problem?id=1715 #include <stdio.h> #include <algorithm> using namespace std; char *digit = "FEDCBA9876543210"; //0123456789ABCDEF"; int p[8][8]; bool sign[16]; int main() { int i,j,n,k; char ans[9]; for( k=0; k<8; k++ ) { p[k][7-k] = 1; for( i=6-k; i>=0; i– ) p[k][i] = … Continue reading
Posted in poj
Leave a comment
Poj Solution 1714
http://poj.org/problem?id=1714 #include <stdio.h> #include <algorithm> using namespace std; struct node { int id; int order; node *l,*r,*f; int lv,rv,fv; }tree[600]; node *leaf[600]; int n, k; int e[600][3]; int v[600][3]; int d[600]; inline bool isleaf( node *s ) { return s->id … Continue reading
Posted in poj
Leave a comment
Poj Solution 1710
http://poj.org/problem?id=1710 #include<iostream> #include"memory.h" using namespace std; int n; bool map[101][101]; void init() {int i,j;bool k; k=1; for(i=1;i<=n;i++,k=!k) map[i][1]=k; for(i=1;i<=n;i++) for(j=2;j<=n;j++) map[i][j]=!map[i][j-1]; } void doit() {int i,j,step=2*n+1;bool k=true; for(i=1;i<n;i++) {cout<<step; for(j=1;j<=n;j++) if(map[i][j]==k)cout<<‘ ‘<<(i-1)*n+j; cout<<endl; step+=2;k=!k; cout<<step; for(j=1;j<=n;j++) if(map[i][j]==k)cout<<‘ ‘<<(i-1)*n+j; cout<<endl; step+=2;k=!k; … Continue reading
Posted in poj
Leave a comment
Poj Solution 1709
http://poj.org/problem?id=1709 #include<iostream> #include"memory.h" #include"string.h" using namespace std; char word[1000][23]; int index[27]; int n,l,len[1000],set[1000]; void init() { int i; for(i=0;i<26;i++)index[i]=n; for(i=0;i<n;i++) { cin>>word[i]; len[i]=strlen(word[i]); if(index[word[i][0]-‘a’]==n)index[word[i][0]-‘a’]=i; } memset(set,1,1000*sizeof(int)); } char best[100];int go; char w[100]; void find(int a,int b) { if(go&&strcmp(w,best)>0)return; if(b==a&&a) { … Continue reading
Posted in poj
Leave a comment
Poj Solution 1708
http://poj.org/problem?id=1708 #include<iostream> #include"memory.h" using namespace std; int set[100][100]; int map[100][10000][2]; int path[100]; int n,l,k,q; int cir[100]; void init() {int i,m,a,b; memset(path,0,100*sizeof(int)); memset(set,0,100*100*sizeof(int)); cin>>n>>l>>k>>q; l–;k–;q–; for(i=0;i<n;i++)cin>>cir[i]; cin>>m; for(i=0;i<m;i++){cin>>a>>b;a–;b–; cin>>map[a][path[a]++][1]; map[a][path[a]-1][0]=b;} } int queue[10000][3],head,tail; void find() {int a,b,c,i,to; head=0;tail=0; queue[tail][0]=l;queue[tail][1]=k; queue[tail][2]=0; set[l][k]=set[k][l]=1; … Continue reading
Posted in poj
Leave a comment