thanks a lot Anil for your replay :)
about the print function i use static import
import static java.lang.System.out;
so i can use
out.println("blablabla");
2009/9/7 Anil Kishore <[email protected]>
> Hmm.. looks fine. Take care of 'next()' and 'nextLine()' of the Scanner
> class and try out a few things. Also, initialize two strings with the path
> to directories of input and output files, if needed. Also, you may prepare a
> small template to take number of test cases, put a loop and print 'Case #x:
> ', as its the case with most of the problems in gcj.
> You may also have a print function, to check things and print on standard
> output.. (instead of writing System.out.println every time ) it can be
> something like this. Try out a few things before using it in contest.
>
> final static void print(Object... ob) {
> System.out.println(Arrays.deepToString(ob));
> }
>
> Efficiency in taking inputs and printing is not at a problem in gcj, as we
> have enough time here (worst case 3-5secs delay is fine). Algorithm matters
> the most.
>
> Finally, good to know that you shifted to Java ;)
>
> - AK
>
>
>
>
> On Mon, Sep 7, 2009 at 10:27 PM, Ahmed Medhat <[email protected]>wrote:
>
>> Dear all java coders,
>>
>> I was using C++ for coding in such computations and now I try to use Java
>> and I use the following template please if there any comments about
>> performance or if any one who have a another one which is more efficient
>> than mine ?
>>
>>
>>
>> import java.io.*;
>> import java.util.Scanner;
>> /**
>> * @author: Ahmed.Medhat
>> * @Email:[email protected] <email%[email protected]>
>> * @CodeJam_Handel: Egy.Turing
>> */
>> public class Test {
>>
>> /* if test -->0
>> * if small -->1
>> * if large -->2
>> */
>> int testType = 0;
>>
>> Scanner sc;
>> PrintWriter pw;
>>
>> Test()throws Exception{
>> init();
>>
>> //Write the code here
>>
>> pw.flush();
>> sc.close();
>> }
>> void init()throws Exception{
>> if(testType==0){
>> sc = new Scanner(new FileReader("c-test.in"));
>> pw = new PrintWriter(new FileWriter("c-test.out"));
>> }
>> else if(testType==1){
>> sc = new Scanner(new FileReader("c-small.in"));
>> pw = new PrintWriter(new FileWriter("c-small.out"));
>> }
>> else if(testType==2){
>> sc = new Scanner(new FileReader("c-large.in"));
>> pw = new PrintWriter(new FileWriter("c-large.out"));
>> }
>> }
>> public static void main(String[] args) throws Exception{
>> new Test();
>> System.exit(0);
>> }
>> }
>>
>> --
>> Kind Regards,
>>
>> Ahmed Medhat
>> Computer Science
>> Alexandria university
>> Egypt
>>
>>
>>
>
> >
>
--
Kind Regards,
Ahmed Medhat
Computer Science
Alexandria university
Egypt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-codejam" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-code?hl=en
-~----------~----~----~----~------~----~------~--~---