import java.text.*; import java.io.*; import java.util.*; public class ____ { // put "throws Exception" at the end of your method declarations so // you don't have to worry about try ... catch blocks public static void main(String[] args) throws Exception { // change the FileReader to a InputStreamReader(System.in) if you // need to read standard input BufferedReader br = new BufferedReader(new FileReader("filename.in")); // read an int and a double from the first line - get friendly // with StringTokenizer, it's extremely effective for parsing input StringTokenizer st = new StringTokenizer(br.readLine()); int a = Integer.parseInt(st.nextToken()); double b = Double.parseDouble(st.nextToken()); // the second line contains only an int - use .trim() because // Integer.parseInt throws an exception if there is leading or // trailing whitespace. we didn't have to worry about this above // because StringTokenizer eats whitespace int c = Integer.parseInt(br.readLine().trim()); System.out.println(a + " " + b + " " + c); // print pi accurate to two decimal places - if you need to do // lots of formatting, instantiate a single NumberFormatter // and re-use it. NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(2); // don't forget this next line... otherwise it'll put commas in // for you [1000000.00 -> 1,000,000.00] nf.setGroupingUsed(false); System.out.println(nf.format(Math.PI)); } } // you can only have one public class per file. if you need another // class, don't make it public. class Point { public int x; public int y; } // EOF other stuff: the easiest way to emulate something like printf("%5d", x); is to use a StringBuffer and insert some spaces in the front. every once in a while you'll come across a program that wants output in scientific notation [printf's "%E" format]. there is no easy way [that i know of] to do this in java. it would be a good idea to write yourself a function that prints doubles in scientific notation. creating objects is expensive in java. note that each time you use the '+' operator to concatenate strings, you're instantiating a StringBuffer. if you need to do a lot of concatenation, it's much more efficient to make your own StringBuffer and call the "append" method multiple times. understand how to use java's Collections framework. see http://java.sun.com/j2se/1.3/docs/guide/collections/reference.html in particular, the Arrays class [java.util.Arrays] has several useful static methods for dealing with arrays [sort, binary search, etc]. there's some potentially useful stuff geometry stuff in java.awt.geom, but be careful... it's supposed to be used for user interface stuff, so a lot of functions use floats instead of doubles. also, some of the functions aren't as general as you'd probably like them to be [contains() won't let you specify whether a point on the border counts as in or out], so it's best to have your own implementations to fall back on if the geom package doesn't do exactly what you want. check out java.math. it contains BigInteger and BigDecimal, which might save you time.