# Monthly Archives: August 2015

## Poj Solution 3217

http://poj.org/problem?id=3217 #include <stdio.h> #include <memory.h> #include <vector> using namespace std; vector<int> ch; int father, mother; bool gender; int A, B; void input( ) { int i, h, t; scanf( "%d%d", &A, &B ); for( i=0; i<101; i++ ) ch[i].clear( ); … Continue reading

Posted in poj | Comments Off on Poj Solution 3217

## Poj Solution 3214

http://poj.org/problem?id=3214 #include <stdio.h> #include <memory.h> #include <vector> #include <algorithm> using namespace std; vector<int> v; int a; int t; int n, m, h; int vn; void input( ) { int i, j; scanf( "%d", &m ); for( i=0; i<m; i++ ) … Continue reading

Posted in poj | Comments Off on Poj Solution 3214

## Poj Solution 3212

http://poj.org/problem?id=3212 #include <stdio.h> #include <memory.h> #include <vector> #include <algorithm> using namespace std; #define __int64 long long const int size = 100010; __int64 s[size]; int ss[size]; int m; int pos; //��� void clear( ) { memset( s, 0, sizeof s ); … Continue reading

Posted in poj | Comments Off on Poj Solution 3212

## Poj Solution 3211

http://poj.org/problem?id=3211 #include <stdio.h> #include <vector> #include <string> #include <set> using namespace std; vector<int> v; string color; set<int> s; int main( ) { int n, m, i, j, ans, sum, t, best; char w; while( scanf( "%d%d", &m, &n ) == … Continue reading

Posted in poj | Comments Off on Poj Solution 3211

## Poj Solution 3210

http://poj.org/problem?id=3210 //* @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))); int n; while (true){ n=scanner.nextInt(); if (n==0){ break; } if (n%2==0){ System.out.println("No Solution!"); } else{ System.out.println(n-1); } } } … Continue reading

Posted in poj | Comments Off on Poj Solution 3210

## Poj Solution 3208

http://poj.org/problem?id=3208 /* @author: */ import java.util.Scanner; public class Main { static int s[][]=new int; static int to[][]=new int; static void doit( ) { int i, j, k; for( i=0; i< 3; i++ ) for( j=0; j< 10; j++ ) to[i][j] … Continue reading

Posted in poj | Comments Off on Poj Solution 3208

## Poj Solution 3199

http://poj.org/problem?id=3199 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()) { BigDecimal n = scan.nextBigDecimal(); int d = scan.nextInt(); if (d == 0 && n.equals(BigDecimal.ZERO)) … Continue reading

Posted in poj | Comments Off on Poj Solution 3199

## Poj Solution 3198

http://poj.org/problem?id=3198 /* @author: */ import java.math.BigInteger; import java.util.*; public class Main { public static BigInteger get( BigInteger h ) { BigInteger s = h.shiftLeft(1); BigInteger a = BigInteger.ONE.shiftLeft( s.bitLength()/2-1 ).subtract( BigInteger.ONE ); BigInteger b = BigInteger.ONE.shiftLeft( s.bitLength()/2+1 ), c; while( … Continue reading

Posted in poj | Comments Off on Poj Solution 3198

## Poj Solution 3194

http://poj.org/problem?id=3194 /* @author: */ import java.util.Scanner; import java.util.Arrays; public class Main{ static int p[][]=new int; static int q[][]=new int; static int n,cnt; static void dfs(int i,int j) { if(i>n||j>n||i< 1||j< 1) return; q[i][j]=cnt; if(q[i][j+1]==0&&p[i][j]==p[i][j+1]) dfs(i,j+1); if(q[i][j-1]==0&&p[i][j]==p[i][j-1]) dfs(i,j-1); if(q[i+1][j]==0&&p[i][j]==p[i+1][j]) dfs(i+1,j); if(q[i-1][j]==0&&p[i][j]==p[i-1][j]) … Continue reading

Posted in poj | Comments Off on Poj Solution 3194

## Poj Solution 3193

http://poj.org/problem?id=3193 //* @author: <strong>Yeming&nbsp;Hu</strong>&quot;cslittleye@gmail.com&quot; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String mn = sc.nextLine(); Scanner lmn = new Scanner(mn); int m = lmn.nextInt(); int n = lmn.nextInt(); String[] phrases … Continue reading

Posted in poj | Comments Off on Poj Solution 3193

## Poj Solution 3192

http://poj.org/problem?id=3192 #include <stdio.h> #include <algorithm> #include <string> #include <string.h> using namespace std; int index; char sum; char str; int len; int merge( int len, char *w, int l ) { int i = len-l, j; if( i<0 ) i = … Continue reading

Posted in poj | Comments Off on Poj Solution 3192

## Poj Solution 3191

http://poj.org/problem?id=3191 /* @author: */ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i, n, h; boolean s[]=new boolean; n=sc.nextInt(); if( n == 0 ) { System.out.printf( "0n" ); return ; … Continue reading

Posted in poj | Comments Off on Poj Solution 3191

## Poj Solution 3190

http://poj.org/problem?id=3190 #include <stdio.h> #include <algorithm> #include <string> #include <string.h> using namespace std; int empty; int use; int a, b; typedef pair<int,int> p_i; p_i p; int main( ) { int i, n, m, ans=0; scanf( "%d", &n ); for( i=0; i<n; … Continue reading

Posted in poj | Comments Off on Poj Solution 3190