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 ]  

4/e/divby17.java

Robert Kelly
Problem "Divide by 17"
import java.math.BigInteger;
import java.util.*;
public class divby17{
	public static void main(String[] args){
		String modder2 = "17";
		BigInteger modder = new BigInteger(modder2);
		Scanner in = new Scanner(System.in);
		while(in.hasNextBigInteger()){
			BigInteger num = new BigInteger(in.nextBigInteger().toString());
			if(num.equals(BigInteger.ZERO)==false){
				BigInteger mod = new BigInteger(num.mod(modder).toString());

				if(mod.equals( BigInteger.ZERO)){
					System.out.println(1);
				}else{
					System.out.println(0);
				}
			}
		}
	}
}

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