# 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

## 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

## 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

## 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

## 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

## 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

## 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