ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1000. A+B Problem

Please, what's wrong with my code
Posted by Taiwo Azeez 18 Dec 2014 06:37
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
Posted by Taiwo Azeez 19 Dec 2014 23:39
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?