Competitive/Collaborative Programming Class

ICPC Computer Programming Contest Prep

Problem Solving in Computer Science

Fall 2011 -- CSC 2700 Section 02

[Isaac's Home Page ]  [Mailing List ]  [Class Page ]  [Normal ]  

12/m/CutTheSilverBar.java

 import java.util.*;
/*
   Man Vo
   UVA 11847: Cut the Silver Bar
   11/20/11
*/
    
   public class CutTheSilverBar{
	   public static void main(String[]args){
		   Scanner input = new Scanner(System.in);
		   int cut = input.nextInt();
		   while(cut!=0){
			   System.out.println((int)Math.floor(Math.log10(cut)/Math.log10(2)));
			   cut = input.nextInt();
		   }
	   }
   }

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 Isaac Traxler