/* @JUDGE_ID: 10839CM 100 Java "Prob. 100 from TJ" */ /* In the comment above: USER_ID PROG_NUMBER LANGUAGE STRING COMMENT */ /* @BEGIN_OF_SOURCE_CODE */ import java.io.*; import java.util.*; class Main //FOR JAVA, I THINK YOU MUST CALL THIS CLASS MAIN!!! { public static int hailstone(int k) { ... CODE GOES HERE ... } static String ReadLn (int maxLg) // utility function to read from stdin { byte lin[] = new byte [maxLg]; int lg = 0, car = -1; String line = ""; try { while (lg < maxLg) { car = System.in.read(); if ((car < 0) || (car == '\n')) break; lin [lg++] += car; } } catch (IOException e) { return (null); } if ((car < 0) && (lg == 0)) return (null); // eof return (new String (lin, 0, lg)); } public static void main (String args[]) // entry point from OS { Main myWork = new Main(); // create a dinamic instance myWork.Begin(); // the true entry point } void Begin() { String input; StringTokenizer idata; int i, j, min, max, num, n, cycle, cyclemax; while ((input = Main.ReadLn (255)) != null) { idata = new StringTokenizer (input); i = Integer.parseInt (idata.nextToken()); j = Integer.parseInt (idata.nextToken()); /* a = Integer.parseInt (idata.nextToken()); b = Integer.parseInt (idata.nextToken()); if (a < b) { min=a; max=b; } else { min=b; max=a; } ... OR YOU CAN CALCULATE CYCLEMAX HERE ... } System.out.println (a + " " + b + " " + cyclemax); */ /* THIS VERSION BELOW USES A CALL TO FUNCTION HAILSTONE() */ int a = i; int b = j; max = 0; if(i > j) { a = j; b = i; } for(int k = a; k <= b; k++) { int temp = hailstone(k); if(temp > max) max = temp; } System.out.println("" + i +" " + j + " " + max); } } } /* @END_OF_SOURCE_CODE */