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

Re:Huge input,Java is not recommended.

Posted by trbot at 2009-01-09 07:46:12 on Problem 1396
In Reply To:Huge input,Java is not recommended. Posted by:Judas at 2006-03-15 21:29:45
> -_-
> - _ - 

Use BufferedOutputStream, and array of ' ', '-'

BufferedOutputStream out=new BufferedOutputStream(System.out, 1024);

...

String space="                                ";
String dash="--------------------------------";
for (int i=0;i<5;i++) {
	space+=space;
	dash+=dash;
}
this.space=space.getBytes();
this.dash=dash.getBytes();

...

out.write(space, 0, width-alen);
out.write(abytes, 0, alen);
out.write('\n');

...

etc. 1000x faster.

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