|
|
back to boardPlease, what's wrong with my code import java.io.*; import java.util.*; public class TokenExplain { public static void main(String[] args) throws IOException { //this program gets two tokens on a single line and calculates their sum StreamTokenizer in =new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); in.nextToken(); int a=(int)in.nval; in.nextToken(); int b=(int) in.nval; System.out.println(a+b); }
} As you can see, it was well written, but when it was compiled, it took 0.078 seconds while i see fellow java coders clocking speed of 0.031, can you suggesting better classes to read inputs instead of the one i used, all other suggestions are highly welcome Re: Please, what's wrong with my code Posted by ACkf 19 Dec 2014 20:30 It has no problem and can be accepted. Re: Please, what's wrong with my code Yes, it was accepted but that is not the issue. The real issue is how i can optimize the code in such a way to clock 0.031 sec that others clocked. Thanks. Re: Please, what's wrong with my code Posted by ACkf 20 Dec 2014 11:02 But I cant find the code which clock 0.031 by google. Can anyone help me? |
|
|