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: May 2014
Poj Solution 2766
http://poj.org/problem?id=2766 /* @author: */ import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int dx[]={0,1,0,-1},dy[]={1,0,-1,0}; int g[][]=new int[52][52]; int ca,i,j,k,n,r,x,y,dir; ca=sc.nextInt(); while ((ca–)!=0) { n=sc.nextInt(); r=sc.nextInt(); for(i=0;i< g.length;i++) Arrays.fill(g[i],0); for … Continue reading
Posted in poj
Leave a comment
Poj Solution 2765
http://poj.org/problem?id=2765 #include <stdio.h> #include <string.h> struct product{ char w[100]; char name[110][100]; int per[110]; int most[110], least[110]; int m; }p[10]; int n; void clac( product &a ) { int s = 0, r = 100, i, j, k, low[100], up[100], sum, … Continue reading
Posted in poj
Leave a comment
Poj Solution 2760
http://poj.org/problem?id=2760 #include "stdio.h" #include "math.h" #include "memory.h" #include "algorithm" using namespace std; #define y1 sdgdsf double clac( double h0, double h1, double x0, double x1 ) { return h0/(h0-h1)*( x1 – x0 ) + x0; } double sum[5048]; struct node … Continue reading
Posted in poj
Leave a comment
Poj Solution 2757
http://poj.org/problem?id=2757 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String args[]) throws Exception { Scanner cin=new Scanner(System.in); BigInteger n; long b; while(cin.hasNext()) { n=cin.nextBigInteger(); b=cin.nextLong(); if(n.compareTo(BigInteger.ZERO)<=0) { System.out.println("0"); continue; } BigInteger ans; … Continue reading
Posted in poj
Leave a comment
Poj Solution 2756
http://poj.org/problem?id=2756 import java.util.*; import java.math.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int num = Integer.valueOf(cin.nextLine()).intValue(); for(int i = 0; i < num; i++) { String[] str = cin.nextLine().split(" "); BigDecimal a … Continue reading
Posted in poj
Leave a comment
Poj Solution 2751
http://poj.org/problem?id=2751 /* @author: */ import java.util.Scanner; public class Main { static int a[][]=new int[10001][2]; static int b[][]=new int[10001][2]; static int an,bn; static void sort(){ int i,j,t1,t2; for(i=0;i< an;i++) for(j=0;j< an;j++) { if(a[i][0]< a[j][0]) { t1=a[i][0];t2=a[i][1]; a[i][0]=a[j][0];a[i][1]=a[j][1]; a[j][0]=t1;a[j][1]=t2; } } for(i=0;i< … Continue reading
Posted in poj
Leave a comment
Poj Solution 2750
http://poj.org/problem?id=2750 #include "stdio.h" #include "memory.h" const int SIZE = ( 1<<18 ); const int LEAF = ( 1<<17) – 1; int sum[SIZE],l_max[SIZE],r_max[SIZE],l_min[SIZE], r_min[SIZE], min_e[SIZE], s_max[SIZE], s_min[SIZE], pn, n; inline int max( int a, int b ) { return a>b?a:b; } … Continue reading
Posted in poj
Leave a comment
Poj Solution 2749
http://poj.org/problem?id=2749 #include "stdio.h" #include "memory.h" #include "vector" #include "algorithm" #include "functional" #include "math.h" #define max asdfds using namespace std; const int SIZE = 700; typedef pair<int,int> pair_int; int sign[SIZE*2], MS; pair_int e[SIZE*2][SIZE*2], _e[SIZE*2][SIZE*2]; int en[SIZE*2], _en[SIZE*2]; int n; void init( … Continue reading
Posted in poj
Leave a comment
Poj Solution 2748
http://poj.org/problem?id=2748 import java.io.*; 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[] fb=new int[75000]; fb[0]=1; fb[1]=1; for(int i=2;i< 75000;i++) fb[i]=(3*fb[i-1]-fb[i-2]+200000)%100000; while((a–)!=0) { int b=Integer.parseInt(in.readLine()); System.out.println(fb[b%75000]); } } }
Posted in poj
Leave a comment
Poj Solution 2744
http://poj.org/problem?id=2744 /* @author: */ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double b,v,e,f,t[]=new double[101],t1; int n,a[]=new int[101],r; int i,j,k,dis; while(sc.hasNext()) { n=sc.nextInt(); if(n==0) break; a[0]=0; for(i=1;i<=n;i++) a[i]=sc.nextInt(); b=sc.nextDouble(); r=sc.nextInt(); v=sc.nextDouble(); … Continue reading
Posted in poj
Leave a comment
Poj Solution 2739
http://poj.org/problem?id=2739 import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int n=1; while(true){ n=sc.nextInt(); if(n==0) break; System.out.println(test2(n)); } } /* * Sum of Consecutive Prime Numbers */ public static int test2(int x){ int count=0; for(int i=2;i+i< … Continue reading
Posted in poj
Leave a comment
Poj Solution 2738
http://poj.org/problem?id=2738 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; public class Main { static final int M = 2,N = 1000+2; static int value[] = new int[N]; static int map[][][] = new int[N][N][M],n; public static int Get_Num(StreamTokenizer cin) throws Exception{ cin.nextToken(); … Continue reading
Posted in poj
Leave a comment
Poj Solution 2728
http://poj.org/problem?id=2728 //* @author: import java.util.*; import java.math.*; import java.io.FileReader; class Node{ int x,y,z; } public class Main { static int []mark=new int[1010]; static double []dis=new double[1010]; static int []from=new int [1010]; static double sumup,sumdown; static double [][]up=new double [1010][1010]; static … Continue reading
Posted in poj
Leave a comment
Poj Solution 2726
http://poj.org/problem?id=2726 //* @author: 82638882@163.com import java.io.*; import java.util.Arrays; class Main { public static void main(String[] args) throws IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); while(true) { int a=Integer.parseInt(in.readLine()); if(a==0) break; my[] p=new my[a]; for(int i=0;i< a;i++) { String[] ss=in.readLine().split(" … Continue reading
Posted in poj
Leave a comment
Poj Solution 2724
http://poj.org/problem?id=2724 #include <memory.h> #include <stdio.h> #include <string.h> #define null 0 const int size = 2010; bool e[size][size]; int maxmatch( int n, int m, bool w[][size], int *p) { int p_n[size]; int p_m[size]; bool sign[size]; int q[size],from[size],s,t; int i,j,link,now,h; memset( p_n, … Continue reading
Posted in poj
Leave a comment