Monthly Archives: June 2014

Poj Solution 2810

http://poj.org/problem?id=2810 #include <stdio.h> #include <memory.h> #include <vector> #include <string> using namespace std; vector<string> v; int main( ) { double a, b; int i, j; char w[1000], unit[1000]; while( 1 ) { scanf( "%lf %s %lf %1s", &a, unit, &b, w … Continue reading

Posted in poj | Leave a comment

Poj Solution 2800

http://poj.org/problem?id=2800 //* @author: <strong>Yeming&nbsp;Hu</strong>&quot;cslittleye@gmail.com&quot; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n,k; while(sc.hasNext()) { n = sc.nextLong(); k = sc.nextLong(); long sum; if(n<=k) { sum = sumMod(k,n); }else { … Continue reading

Posted in poj | Leave a comment

Poj Solution 2799

http://poj.org/problem?id=2799 //* @author: SmilingWang import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); IPAddress[] ips = new IPAddress[n]; for(int i = 0; i < … Continue reading

Posted in poj | Leave a comment

Poj Solution 2796

http://poj.org/problem?id=2796 //* @author: 82638882@163.com import java.io.*; public class Main { static int[] b,c; static long[] e,d,p; 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()); p=new long[a+2]; b=new int[a+1]; c=new int[a+1]; d=new long[a+1]; e=new … Continue reading

Posted in poj | Leave a comment

Poj Solution 2785

http://poj.org/problem?id=2785 //* @author: 82638882@163.com import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); String s=in.readLine(); int a=Integer.parseInt(s); int[] t1=new int[a]; int[] t2=new int[a]; int[] t3=new int[a]; int[] … Continue reading

Posted in poj | Leave a comment

Poj Solution 2782

http://poj.org/problem?id=2782 //* @author: 82638882@163.com import java.util.*; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); int a=in.nextInt(); int b=in.nextInt(); ArrayList< Integer> t=new ArrayList< Integer>(); while((a–)!=0) t.add(in.nextInt()); Collections.sort(t); int count=0; int u=t.size()-1; int k=0; while(k<=u) { int … Continue reading

Posted in poj | Leave a comment

Poj Solution 2781

http://poj.org/problem?id=2781 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<string.h> #include<math.h> #define INF 3000000 #define NMAX 1000000 int N; typedef struct { int len; int next[101]; }DATA; DATA a[NMAX]; int st,ed; void input() { int i,j; scanf("%d",&N); int tmp; for(i=0;i<N;i++) { scanf("%d%d",&tmp,&a[i].len); for(j=0;j<a[i].len;j++) { scanf("%d",&a[i].next[j]); … Continue reading

Posted in poj | Leave a comment

Poj Solution 2780

http://poj.org/problem?id=2780 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; class Point implements Comparable { double x,y; public int compareTo(Object obj){ Point temp = (Point) obj; if(temp.x!=this.x){ if(temp.x< this.x) return 1; return -1; } if(temp.y< this.y) return 1; return -1; } } … Continue reading

Posted in poj | Leave a comment

Poj Solution 2777

http://poj.org/problem?id=2777 import java.io.*; import java.util.*; public class Main { static tree[] mytree=new tree[300003]; static boolean[] flag=new boolean[35]; public static void main(String args[]) throws Exception { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); String[] ss=in.readLine().split(" "); int l=Integer.parseInt(ss[0]); int t=Integer.parseInt(ss[1]); int o=Integer.parseInt(ss[2]); … Continue reading

Posted in poj | Leave a comment

Poj Solution 2775

http://poj.org/problem?id=2775 #include "stdio.h" struct tree{ int l, r; int v; int ans; int nds; }t[200]; int n, m; int new_node( int value ) { t[m].l = t[m].r = -1; t[m].v = value; t[m].nds = 1; m++; return m-1; } int … Continue reading

Posted in poj | Leave a comment

Poj Solution 2774

http://poj.org/problem?id=2774 #include "stdio.h" #include "memory.h" #include "string.h" #include "stdlib.h" const int CHAR_NUM = 27; const int MAXSIZE = 500000; struct suftree{ suftree *ch[CHAR_NUM]; char *l, *r; int len; suftree *s, *p; }suft[MAXSIZE]; int use_node = 0; /////////////////////////////////////////////// suftree *new_node( ) … Continue reading

Posted in poj | Leave a comment

Poj Solution 2773

http://poj.org/problem?id=2773 //* @author: 82638882@163.com import java.util.*; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); while(in.hasNext()) { int a=in.nextInt(); int b=in.nextInt(); if(a==1)System.out.println(b); else{ ArrayList< Integer> arr=new ArrayList< Integer>(); for(int i=1;i< a;i++) { int m=a,n=i; while(m%n!=0) { … Continue reading

Posted in poj | Leave a comment

Poj Solution 2769

http://poj.org/problem?id=2769 //* @author mekarlos@gmail.com import java.util.Hashtable; import java.util.Scanner; public class Main { public static void main(String[] args) { Hashtable< Integer,Integer> table; Scanner scan=new Scanner(System.in); int M[]=new int[300]; int n=scan.nextInt(),k=0,m=1; boolean band=false; for(int i=0;i< n;i++){ k=scan.nextInt(); band=true; table=new Hashtable< Integer, Integer>(); … Continue reading

Posted in poj | Leave a comment