/* ID: stud1 LANG: JAVA PROG: newPrg */ // This template typifies model code for algorithmic contests. // This template evolved from USACO computing contest template. // Substitute NEW name of program whereever you find "newPrg". import java.io.*; // supports RandomAccessFile & PrintWriter import java.util.*; // supports StringTokenizer class newPrg { public static void main (String [] args) throws IOException { // Code to import io and util packages drawn from prepared template. // Code to open & close files drawn from prepared contest template. // Code to declare/initialize array drawn from prepared template. // ======== Open channels to input and output files. ============ RandomAccessFile in = new RandomAccessFile ("newPrg.in", "r"); PrintWriter out = new PrintWriter( new BufferedWriter( new FileWriter("newPrg.out"))); // ====== Read one line - initialize three tokens in line. ===== StringTokenizer st = new StringTokenizer(in.readLine()); long firstToken = Long.parseLong(st.nextToken()) ; long secondToken = Long.parseLong(st.nextToken()) ; long thirdToken = Long.parseLong(st.nextToken()) ; System.out.println( "First integer = " + firstToken ) ; System.out.println( "Second integer = " + secondToken ) ; System.out.println( "Third integer = " + thirdToken ) ; // ==== Declare and initialize arrays with initializer list. === int t=0,w=0 ; // initialize primitives. int cat[][] = new int[35][2]; // array of 35 rows and 2 columns int apple[] = new int[10]; // array of 10 cells numbered 0 .. 9 int stud[] = { 16, 15, 44, 99 , 9 } ; // array declared & initialized // 2-dimensional arrary declared with initializer list String seatPlan[][] = { { "Jane", "Shinji", "Anund" } , { "Joe", "Frank", "Patrick" } , { "PC", "Vicent", "Chris" } , { "Bei", "Dominic", "Andrew" } , } ; // end array's first dimension declaration // ====== Initialize array by reading strings from a file. ===== for ( int i=0 ; i