Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

给个java的高效读取程序,此题读取量大,多次读取可能tle

Posted by 90820120 at 2010-06-27 23:43:03 on Problem 2887
         class Reader{
		byte[] b;
		int i;
		Reader(int length){
			b = new byte[length];
			i = 0;
		}//此题length可设为1100000
		public int lineLength(){
			while(b[i]!=13&&b[i]!=10)i++;
			return i;
		}
		private void skip(){
			while(b[i]==13||b[i]==10||b[i]==32)i++;
		}
		public int nextInt(){
			skip();
			String s=new String();
			while(b[i]>47&&b[i]<58)s+=(char)b[i++];
			return Integer.parseInt(s);
		}
		public char nextChar(){
			skip();
			return (char)b[i++];
		}
	}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator