# Monthly Archives: January 2011

## Poj Solution 1689

http://poj.org/problem?id=1689 #include<iostream> #include"vector" #include"algorithm" #define max(x,y) (((x)>(y))?(x):(y)) #define min(x,y) (((x)<(y))?(x):(y)) using namespace std; struct point {long x,y;}; struct type_dbx {int n; point d[50]; }; type_dbx dbx[50]; vector <long> x,y; long mx,my; int n; char sign[50*50*2]; inline long cheng(point a,point b,point … Continue reading

Posted in poj | Leave a comment

## Poj Solution 1687

http://poj.org/problem?id=1687 #include<iostream> #include"math.h" using namespace std; long x[50],y[50]; inline long cheng(int a,int b,int c) {return (x[a]-x[b])*(y[a]-y[c])-(x[a]-x[c])*(y[a]-y[b]);} int main() {int t,n,m,p[50],h,key,i,j,l;char s[50];long an,anb; cin>>t; for(;t>0;t–) {cin>>n; for(i=0;i<n;i++) cin>>x[i]>>y[i]; cin>>m;key=0;anb=0; for(l=0;l<m;l++) {cin>>h; for(i=0;i<h;i++){cin>>p[i];p[i]–;} an=0; for(i=1;i<h-1;i++) { an+=cheng(p[0],p[i],p[i+1]); } // cout<<":::"<<an<<endl; if(abs(an)>anb){anb=abs(an);key=l+1; } … Continue reading

Posted in poj | Leave a comment

## Poj Solution 1686

http://poj.org/problem?id=1686 //* @author: import java.util.Scanner; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; public class Main{ ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("JavaScript"); Scanner cin=new Scanner(System.in); int[] num=new int[60]; void init() { for(int i=1;i< 59;i++) num[i]=i+9997; } void solve() throws … Continue reading

Posted in poj | Leave a comment

## Poj Solution 1685

http://poj.org/problem?id=1685 #include<iostream> #include"math.h" #include"stdio.h" using namespace std; double x[60][2],y[60][2],xs,ys,xt,yt; double best1[62][2],best2[62][2],len[62]; int color[60],cl,c[62]; inline double jl(double a,double c,double b,double d) {return sqrt((a-b)*(a-b)+(c-d)*(c-d));} int main() {int t,i,j,k,n;double ss,tt; cin>>t; for(;t>0;t–) {cin>>xs>>ys>>xt>>yt; cin>>cl; for(i=0;i<cl;i++)cin>>color[i]; cin>>n; for(i=0;i<n;i++){cin>>x[i][0]>>y[i][0]>>x[i][1]>>y[i][1]>>c[i]; len[i]=jl(x[i][0],y[i][0],x[i][1],y[i][1]);} for(i=0;i<n;i++) if(c[i]==color[0]){best1[i][0]=jl(xs,ys,x[i][0],y[i][0])+len[i]; best1[i][1]=jl(xs,ys,x[i][1],y[i][1])+len[i];} else best1[i][0]=best1[i][1]=999999999999; … Continue reading

Posted in poj | Leave a comment

## Poj Solution 1683

http://poj.org/problem?id=1683 #include<iostream> using namespace std; int h[50][8],n,m; char obj[8][8]; int sign[50][50]; int alive[50]; int can(int i,int j) {int k; for(k=0;k<n;k++) if(h[i][k]*h[j][k]>0)break; if(k==n)return 1; else return 0; } void merage(int a,int b) {int i; for(i=0;i<n;i++)h[a][i]+=h[b][i]; for(i=0;i<n*m;i++){sign[a][i]+=sign[b][i];sign[i][a]+=sign[i][b];} alive[b]=-a; } int main() {int … Continue reading

Posted in poj | Leave a comment

## Poj Solution 1681

http://poj.org/problem?id=1681 //* @author: import java.util.*; public class Main { static Scanner in = new Scanner(System.in); static char[][] board;//���ڱ����ʼ״̬ static boolean[][] map;//ǽ�ڵ�״̬ static int cnt;//Ϳ��Ĵ��� static void click(int x, int y) {//Ϳ��x,y)���ĸ��� ++cnt; map[x][y] = !map[x][y]; if(x-1>=0) map[x-1][y] = !map[x-1][y];//����ĸ��� if(y-1>=0) … Continue reading

Posted in poj | Leave a comment

## Poj Solution 1679

http://poj.org/problem?id=1679 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; class Edge{ int u,v,disten; void set(int u,int v,int disten){ this.u = u; this.v = v; this.disten = disten; } } interface MST{ int N = 100+2,BIG = 1000000000; int getMST(int op); } … Continue reading

Posted in poj | Leave a comment

## Poj Solution 1677

http://poj.org/problem?id=1677 //* @author /** * pku 1677 Girls’ Day * Memory: 3524K Time: 172MS * Language: Java Result: Accepted * @Author conanhjj */ import java.util.*; public class Main { static Scanner in = new Scanner(System.in); static int g,w; static String[] … Continue reading

Posted in poj | Leave a comment

## Poj Solution 1676

http://poj.org/problem?id=1676 //* @author: 82638882@163.com import java.io.*; public class Main { public static void main(String[] args) throws IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); int a=Integer.parseInt(in.readLine()); int[] N=new int[]{ 119,36,93,109,46,107,123,37,127,111}; while((a–)!=0) { int[] Num1=new int[4]; int[] Num2=new int[4]; String line=in.readLine(); … Continue reading

Posted in poj | Leave a comment

## Poj Solution 1675

http://poj.org/problem?id=1675 /* @author:����acmilan_fan@yahoo.cn */ import java.io.*; public class Main { static double A = Math.PI*2/3; public static void main(String[] args)throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); String[] ss; int num = Integer.parseInt(s); int x1, y1, … Continue reading

Posted in poj | Leave a comment