1.

/**
* FWP, Angewandte Mathematik, SS11
* Problem: 11879 - Multiple of 17
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=226&page=show_problem&problem=3001
*
* @author Sebastian Stumpf
* @author Benjamin Vogt
* @version 1.0, 2011-04-02 08:18:51
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.116
*/

import java.util.*;

public class Main
{
static boolean multipleOf17(String zahlenString)
{
boolean multipleOf17 = false;
StringBuilder sb = new StringBuilder(zahlenString);
for(int i = sb.length()-1; i >= 0; i = sb.length()-1)
{
int lastDigit = (5 * (sb.charAt(i) - 48));
int temp = 0;
if(i > 1)
{
// System.out.println(Character.charCount(sb.codePointAt(i)));
sb.deleteCharAt(i);
temp = lastDigit/10;
if(lastDigit%10 > sb.charAt(i-1) - 48)
{
sb.replace(i-1, i, ""+(sb.charAt(i-1) - 38 - lastDigit%10));
temp++;
}
else
{
sb.replace(i-1, i, ""+(sb.charAt(i-1) - 48 - lastDigit%10));
}

for(int j = i-2; j >= 0; j--)
{
if(temp > sb.charAt(j) - 48)
{
sb.replace(j, j+1, ""+(sb.charAt(j) - 38 - temp));
temp = 1;
}
else
{
sb.replace(j, j+1, ""+(sb.charAt(j)- 48 - temp));
if(sb.charAt(0) == 48)
{
sb.deleteCharAt(0);
}
break;
}
}
}
else if(i == 1)
{
// int a = ((sb.charAt(0) - 48)*10 + sb.charAt(1) - 48)%17;
multipleOf17 = ((sb.charAt(0) - 48)*10 + sb.charAt(1) - 48)%17 == 0;
break;
}
else
{
multipleOf17 = (sb.charAt(0) - 48)%17 == 0;
break;
}
}
return multipleOf17;
}
public static void main(String[] args)
{
String numberStr; // Berechnung

/* StringBuilder sb = new StringBuilder("");
for(long i=1; i<=100000; i++)
{
sb = sb.append(i+"\n");
}
sb.append("0");
String s = sb.toString();
*/

Scanner scanner = new Scanner(System.in);

// long startTime = System.currentTimeMillis();
while((numberStr = scanner.nextLine()).charAt(0) != '0')
{
System.out.println(multipleOf17(numberStr)? "1": "0");
}
// System.out.println(System.currentTimeMillis() - startTime);
}

}


2.

Java-Code:
/**
* Angewandte Mathematik, SS11
* Problem: 11879 Muliple of 17
* Link:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=226&page=show_pr
oblem&problem=3001
*
* @author Brielbeck, Daniel
* @author Weber, Georg
* @version 1.0, 03/29/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.100
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String input = reader.readLine();
char[] number = input.toCharArray();
int l = number.length;
while (!input.equals("0")) {
int n = 0;
for (int i = 0; i < l; i++) {
n = n * 10 + number[i] - 48;
n = n % 17;
}
if (n != 0)
System.out.println("0");
else
System.out.println("1");
input = reader.readLine();
number = input.toCharArray();
l = number.length;
}
}
}

3.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;

/**
* Angewandte Mathematik, SS11
* Problem: 11879 - Multiple of 17
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=226&page=show_problem&problem=3001
*
* @author Benedikt Zšnnchen
* @author Erik Wenzel
* @version 1.0, 03/29/2011
*
* Method : Ad-Hoc
* Status : Accpeted
* Runtime: 0.092
*/

public class Main
{

/**
* @param args
* @throws IOException
*/
public static void main(String[] args)
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line;
int counter = 10;
BigInteger number;
BigInteger div;
try
{
while(counter > 0 && (line = reader.readLine()) != null)
{
counter--;
if(line.length() == 1 && Integer.parseInt(line) == 0)
{
break;
}

number = new BigInteger(line);
div = number.divide(new BigInteger(17+""));

if(number.equals(div.multiply(new BigInteger(17+""))))
{
System.out.println(1);
}
else
{
System.out.println(0);
}
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
}


4.

/**
* Angewandte Mathematik, SS11
* Problem: 11879 Multiple of 17
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=226&page=show_problem&problem=3001
*
* @author Unverzart Michael
* @author Wurth Manuel
* @version 1.0, 03/04/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.104
*/


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class Main {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String inputLine;
while((inputLine = reader.readLine()) != null)
{
if (inputLine.equals("0")) break;
BigInteger i = new BigInteger(inputLine.substring(0, inputLine.length()-1));
BigInteger d = new BigInteger(inputLine.substring(inputLine.length()-1, inputLine.length()));
if(i.subtract(BigInteger.valueOf(5).multiply(d)).mod(BigInteger.valueOf(17)).equals(BigInteger.valueOf(0))) System.out.println("1");
else System.out.println("0");
}
}
}


5.

/**
* Angewandte Mathematik, SS11
* Problem: 11879 - Multiple of 17
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=226&page=show_problem&problem=3001
*
* @author Ritter Marius
* @author Wende Tom
* @author Zehentbauer Stefan
* @version 1.0, 04/17/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.116
*/

import java.util.Scanner;
public class Main {public static void main(String[] args) throws Exception
{
Scanner scan = new Scanner(System.in);
char[] nummer = scan.next().toCharArray();

int stellen = nummer.length;
do
{
int n = 0;
for (int s = 0; s < stellen; s++)
{
n = n * 10 + nummer[s] - 48;
n = n % 17;
}
if (n != 0)System.out.println("0");
else
System.out.println("1");
nummer = scan.next().toCharArray();
if(nummer[0] == '0')break;
stellen = nummer.length;
}while(true);
}
}


--------------------------------------------------------------------
1.

/*
* ACM Contest training
* Problem: 11879 - Multiple of 17
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=226&page=show_problem&problem=3001
*
* @author Christoph Goettschkes
* @version 1.0, 11/08/2010
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.104
*/

import java.io.*;
import java.math.*;


class Main
{
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

BigInteger i = new BigInteger(reader.readLine().trim());

while (!i.equals(BigInteger.ZERO)) {
System.out.println(i.mod(new BigInteger("17")).equals(BigInteger.ZERO) ? 1 : 0);
i = new BigInteger(reader.readLine().trim());
}

}
}