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: September 2009
Poj Solution 1154
http://poj.org/problem?id=1154 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class Main { private static String[] a = null; private static int max = -1; private static int n = 0; private static int m = 0; private static void dfs(int x, … Continue reading
Posted in poj
Leave a comment
Poj Solution 1153
http://poj.org/problem?id=1153 #include <stdio.h> #include<iostream> #include<algorithm> using namespace std; int P[300000]; int SEG=10000000; int main() { long n; long i; long j; double result,tempresult; cin>>n; for(i=0;i<n;i++) { cin>>P[i]; } sort(P,P+n); for(i=0;i<n;i++) { P[i+n]=P[i]+SEG; P[i+2*n]=P[i+n]+SEG; } tempresult=0; int s; s=P[n]+SEG/2; for(i=n+1;P[i]<=s;++i) { … Continue reading
Posted in poj
Leave a comment
Poj Solution 1152
http://poj.org/problem?id=1152 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; public class Main { static int get_base(char c){ if(c>=’0’&&c<=’9′) return c-‘0’+0; if(c>=’A’ && c<=’Z’) return c-‘A’+ 10; if(c>=’a’ && c<=’z’) return c-‘a’ + 36; return -1; } public static void main(String[]args) throws … Continue reading
Posted in poj
Leave a comment
Poj Solution 1151
http://poj.org/problem?id=1151 #include<iostream> #include"stdio.h" #include"vector" #include <algorithm> using namespace std; struct rect {double xt,yt,xb,yb; }; struct point {double x,y;}; double max(double a,double b) {if(a>b)return a; else return b; } double min(double a,double b) {if(a>b)return b; else return a; } /* rect … Continue reading
Posted in poj
Leave a comment
Poj Solution 1150
http://poj.org/problem?id=1150 #include<iostream> #include<cstring> #include<cmath> using namespace std; int get2(int n)//计算n!中质因子2的出现次数 { if(n==0) return 0; return n/2+get2(n/2); } int get5(int n)//计算n!中质因子5的出现次数 { if(n==0) return 0; return n/5+get5(n/5); } ////////////////////////////////////////////////////////////////////////// int g(int n,int x)//计算f(1) to f(n) 中,奇数数列中末尾为x的数出现的次数 { if(n==0) return 0; return … Continue reading
Posted in poj
Leave a comment
Poj Solution 1149
http://poj.org/problem?id=1149 #include <list> #include <vector> using namespace std; class pre_f { public: enum{ MAX = 1000000000 }; //��������� enum{ size = 103 }; //ͼ�����ģ(*) // ����һ��� from �� to �� ��Ϊ c �ı� void insert_edge( int from, int to, int … Continue reading
Posted in poj
Leave a comment
Poj Solution 1148
http://poj.org/problem?id=1148 #include <stdio.h> #include <algorithm> using namespace std; int num[20000], n; int ans_x[10000], ans_y[10000],sign_x[10000], sign_y[10000]; const int xsign[]={ 1, -1, -1, 1 },ysign[]={ 1, 1, -1, -1}, h[]={ 1, -1}; void creat(int end, int num[], int sign[], int ans[], int … Continue reading
Posted in poj
Leave a comment
Poj Solution 1147
http://poj.org/problem?id=1147 #include"stdio.h" int a[3001]; int next[3001]; int main() { int n,i,j,k=0; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d",&a[i]); if(!a[i])k++; } j=1; k++; for(i=1;i<=n;i++) if(a[i]) { next[k]=i; k++; } else { next[j]=i; j++; } k=1; for(i=1;i<=n;i++) { k=next[k]; printf("%d ",a[k]); } return 0; }
Posted in poj
Leave a comment
Poj Solution 1146
http://poj.org/problem?id=1146 /* @author:zeropinzuo */ import java.io.*; import java.util.*; public class Main{ static Scanner cin; public static void main(String args[]){ cin = new Scanner(System.in); while(run(cin.next())) ; } static boolean run(String input){ if(input.compareTo("#") == 0) return false; System.out.println(next(input)); return true; } static … Continue reading
Posted in poj
Leave a comment
Poj Solution 1142
http://poj.org/problem?id=1142 import java.util.Scanner; public class Main { public static int sum = 0; public static boolean isPrime(int num) { for (int i = 2; i <= Math.sqrt(num); i++) { if (num % i == 0) return false; } return true; … Continue reading
Posted in poj
Leave a comment
Poj Solution 1141
http://poj.org/problem?id=1141 //* @author: import java.util.*; public class Main { //f[i][j]��λ��i��λ��j����Ҫ�������С�ַ���ans[i][j]��ʾi��j֮������(��ƥ���ַ� private char s[]; private int len; private int f[][]; private String ans[][]; public Main(char s[]){ this.s=s; this.len=s.length; f=new int[len][len]; ans=new String[len][len]; for(int i=0;i< len;i++) Arrays.fill(ans[i],""); dp(); } public String[][] getAns(){ … Continue reading
Posted in poj
Leave a comment
Poj Solution 1140
http://poj.org/problem?id=1140 /* @author: */ import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(new BufferedInputStream(System.in)); int a,b,i,j,c[],f,d; c=new int[2000]; for(;;) { a=cin.nextInt(); b=cin.nextInt(); if(a==0&b==0)break; c[0]=a;i=0;f=0;j=0;d=1; System.out.print("."); for(;;) { a=(a*10)%b; if(a!=0) { … Continue reading
Posted in poj
Leave a comment
Poj Solution 1137
http://poj.org/problem?id=1137 //* @author:alpc12 import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.lang.Integer; class Node { int x, mask; int s; int f; int action; public Node(int x, int mask, int s, int f, int aa) … Continue reading
Posted in poj
Leave a comment
Poj Solution 1135
http://poj.org/problem?id=1135 import java.util.Scanner; public class Main { static final int Inf=9999999; public static void main(String[] args) { Scanner in=new Scanner(System.in); int cnt=0; while(true) { cnt++; int n=in.nextInt(); int m=in.nextInt(); if(n==0&&m==0)break; int[][] p=new int[n][n]; for(int i=0;i< n;i++) for(int j=0;j< n;j++) p[i][j]=Inf; … Continue reading
Posted in poj
Leave a comment
Poj Solution 1133
http://poj.org/problem?id=1133 #include<iostream> #include"math.h" #include<algorithm> #include<vector> using namespace std; struct point {long x,y;}; typedef point vect; struct {point p; int bright; }star[1001]; int sn,vn; double v_sin,v_cos,bi; vect vec[1001]; double len; point pt[1001]; inline double jl(point &a,point &b) {return sqrt(double(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));} inline long … Continue reading
Posted in poj
Leave a comment