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 2011
Poj Solution 1804
http://poj.org/problem?id=1804 //* @author import java.util.*; public class Main { static int count=0; /** * @param args */ public static void main(String[] args) { Scanner in=new Scanner(System.in); String t=in.nextLine(); int tcase=Integer.parseInt(t); for(int j=1;j<=tcase;j++){ count=0; String str = in.nextLine(); String b[]=str.split("\s"); int … Continue reading
Posted in poj
Leave a comment
Poj Solution 1803
http://poj.org/problem?id=1803 #include"stdio.h" #include<iostream> #include"memory.h" #include"algorithm" using namespace std; int tree[1024*1024*2]; int stop[1024*1024*2]; long m[1024*1024*2]; long area; int x1,y1,x2,y2,key; long temp; void search(int s,long mj); void find(int xu,int yu,int xd,int yd,long s,long mj,int k) { if(xu>=x2||xd<=x1||yu>=y2||yd<=y1){return;} if(key){tree[s]++;} if(!key){tree[s]–;} if(xu>=x1&&yu>=y1&&xd<=x2&&yd<=y2) {if(!key)stop[s]–;else tree[s]–; … Continue reading
Posted in poj
Leave a comment
Poj Solution 1800
http://poj.org/problem?id=1800 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader re=new BufferedReader(new InputStreamReader(System.in) ); int T=Integer.parseInt(re.readLine()); for(int i=1;i<=T;i++) { int n=0,last=0; boolean[] use=new boolean[300010]; Set strset=new TreeSet(); … Continue reading
Posted in poj
Leave a comment
Poj Solution 1799
http://poj.org/problem?id=1799 //* @author popop0p0popo import java.util.*; import java.io.*; import java.text.*; public class Main{ public static void main(String[] args){ Scanner scanner=new Scanner(new BufferedReader(new InputStreamReader(System.in))); int n=scanner.nextInt(); double r,t; for (int i=0;i< n ;i++ ){ r=scanner.nextDouble(); t=scanner.nextDouble(); System.out.println("Scenario #"+(i+1)+":"); DecimalFormat df=new DecimalFormat("0.000"); … Continue reading
Posted in poj
Leave a comment
Poj Solution 1794
http://poj.org/problem?id=1794 /* @author: */ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int cas, k; cas=sc.nextInt(); for( k=1; k<=cas; k++ ) { int s1[]=new int[60010], s2[]=new int[60010]; int i, n, m, … Continue reading
Posted in poj
Leave a comment
Poj Solution 1789
http://poj.org/problem?id=1789 import java.io.PrintWriter; import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); //Scanner scn = new Scanner(Main.class.getResourceAsStream("in.dat")); PrintWriter out = new PrintWriter(System.out); int[][] table; String[] input; int n = 0; while(true){ n = … Continue reading
Posted in poj
Leave a comment
Poj Solution 1787
http://poj.org/problem?id=1787 #include<iostream> #include"memory.h" using namespace std; char set[10000]; int use[10000][4]; long total[10000]; int money[4]={1,5,10,25}; int limit[4],p; void doit() {int i,j,h,k; memset(set,0,10000*sizeof(char)); memset(use,0,10000*4*sizeof(int)); set[0]=1; total[0]=0; for(i=0;i<4;i++) for(j=0;j<=p-money[i];j++) {h=j+money[i]; if(set[j]&&(!set[h]||total[h]<total[j]+1)&&use[j][i]<limit[i]) {set[h]=1; for(k=0;k<4;k++)use[h][k]=use[j][k]; use[h][i]=use[j][i]+1; total[h]=total[j]+1; } } return; } int main() {int i; … Continue reading
Posted in poj
Leave a comment
Poj Solution 1786
http://poj.org/problem?id=1786 //* @author: SmilingWang import java.util.*; public class Main { public static void main(String[] args){ Scanner in = new Scanner(System.in); Map< String, Integer> map = new HashMap< String, Integer>(); map.put("N", 0); map.put("E", 1); map.put("S", 2); map.put("W", 3); String pos[] = … Continue reading
Posted in poj
Leave a comment
Poj Solution 1784
http://poj.org/problem?id=1784 /* @author: */ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int p[]=new int[202]; int q[]=new int[202]; int s[][]=new int[202][202]; int ans[][]=new int[202][202]; int sum[]=new int[202]; int n , i, … Continue reading
Posted in poj
Leave a comment
Poj Solution 1783
http://poj.org/problem?id=1783 #include<iostream> using namespace std; int prime[200],t[200],n; void doprime() {int i,j; n=1; prime[0]=2; for(i=3;i<1000;i++) {for(j=0;j<n;j++)if(i%prime[j]==0)break; if(j==n)prime[n++]=i; } } void fjie(int a[200],int s) {int i; for(i=0;i<200;i++)a[i]=0; for(i=0;i<n&&s>1;i++) while(s%prime[i]==0){a[i]++;s/=prime[i];} } int fn[101][200],fd[101][200],k,m,fdp[101][200],fnp[101][200]; int now[200]; void init() {int i,s,j,h; cin>>s; fjie(now,s); cin>>k; for(i=0;i<k;i++) … Continue reading
Posted in poj
Leave a comment
Poj Solution 1782
http://poj.org/problem?id=1782 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; public class Main { /** * @param args */ public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub int i,j,n,cotinue; boolean is_first; String str; Scanner cin = new Scanner(System.in); … Continue reading
Posted in poj
Leave a comment
Poj Solution 1781
http://poj.org/problem?id=1781 //* @author: 82638882@163.com import java.io.*; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); while(true) { String s=in.readLine(); if(s.equals("00e0")) break; int a=(int)(((s.charAt(0)-‘0’)*10+s.charAt(1)-‘0’)*Math.pow(10, s.charAt(3)-‘0’)); s=Integer.toBinaryString(a); s=s.substring(1)+s.charAt(0); a=Integer.parseInt(s, 2); System.out.println(a); } … Continue reading
Posted in poj
Leave a comment