/* * Author: Son Pham * Date: February 26, 2013 * Purpose: Solves this problem using a simple approach. * Problem: Deloitte Problem 3: Monkey Tree * Comment: Getting this out of the way because it's easy. * Don't worry, I plan on doing harder ones. */ import java.util.Scanner; public class MonkeyTree { public static void main(String[] args) { Scanner reader = new Scanner(System.in); int old = 0; if(reader.hasNextInt()){ //Just in case they give us zero monkeys... old = reader.nextInt(); } int counter = 0; while(reader.hasNextInt()){ int next = reader.nextInt(); if(old > next){ old = next; counter++; } } System.out.println(counter); } }The statements and opinions included in these pages are those of only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015