1.

/**
* ACM Training 2009
* ACM Problem 11231 - Black and white Painting
* @author Miesel Christoph
* @version 3.0 05.08.2009
*
* Status : Accepted
* Runtime: 0.140
*/

import java.util.*;

public class Schach
{
/* Loesung des Problems ueber viele Fallunterscheidungen,
* um den schwierig zu erarbeitenden Gesamtueberblick ueber
* das Problem zu vermeiden!
*/

public static void main(String[] args)
{
int n,m,c;
int erg = 0;

Scanner sc = new Scanner(System.in);
n = sc.nextInt();
m = sc.nextInt();
c = sc.nextInt();

while(n != 0 || m != 0 || c != 0)
{
erg = 0;

// Farbe weiss
if(c == 1)
{
// Spaltenanzahl gerade
if(m % 2 == 0)
{
// Zeilenanzahl gerade
if(n % 2 == 0)
{
if(m >= 8 && n >= 8)
erg += 0.25*(m-6)*(n-6)+0.25*(m-8)*(n-8);
else erg = 0;
}
// Zeilenanzahl ungerade
else
{
if(m >= 8 && n >= 8)
erg += 0.25*(m - 6)*(n - 7)+0.25*(m - 8)*(n - 7);
else erg =0;
}
}
// Spaltenanzahl ungerade
else
{
// Zeilenanzahl gerade
if(n % 2 == 0)
{
if(m >= 8 && n >= 8)
erg += 0.25*(m-7)*(n-6)+0.25*(m-7)*(n-8);
else erg = 0;
}
// Zeilenanzahl ungerade
else
{
if(m >= 8 && n >= 8)
erg += 0.5*(m-7)*(n-7);
else erg = 0;
}
}
}
// Farbe schwarz
else
{
// Spaltenanzahl gerade
if(m % 2 == 0)
{
// Zeilenanzahl gerade
if(n % 2 == 0)
{
if(m >= 8 && n >= 8)
erg += 0.25*(m-8)*(n-6)+0.25*(m-6)*(n-8);
else erg = 0;
}
// Zeilenanzahl ungerade
else
{
if(m >= 8 && n >= 8)
erg += 0.25*(m-8)*(n-7)+0.25*(m-6)*(n-7);
else erg = 0;
}
}
// Spaltenanzahl ungerade
else
{
// Zeilenanzahl gerade
if(n % 2 == 0)
{
if(m >= 8 && n >= 8)
erg += 0.25*(m - 7)*(n - 8) + 0.25*(m - 7)*(n - 6);
else erg = 0;
}
// Zeilenanzahl ungerade
else
{
if(m >= 8 && n >= 8)
erg += 0.5 * (n-7)*(m-7);
else erg = 0;
}
}
}

System.out.println(erg);
n = sc.nextInt();
m = sc.nextInt();
c = sc.nextInt();

}
}
}


2.


/**
* ACM Training, SS09
* ACM Problem #11231 - Black and white painting
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2172
*
* @author Doina Logofatu
* @version 1.0, 06/08/2009
*
* Method: Math
* Status : Accepted
* Runtime: 0.004
*/

#include <stdio.h>

int main() {

int m, n, c;

while(scanf("%d%d%d", &m, &n, &c) && (m||n||c)){

printf("%d\n", ((m-7)*(n-7)+c)/2);

}

return 0;

}


3.

/**
* ACM Training
* ACM Problem # 11231 - Black and White Painting
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2172
*
* @author Felix Dietrich
* @author Dennis Wilfert
* @version 1.0, 09/08/2009
*
* Methode: Analytische Geometrie
* Status : Accepted
* Runtime: 0.100
*/

public class Main
{
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

public static void main(String... strings) throws IOException
{
String input;
StringTokenizer st;
while ((input = br.readLine()) != null)
{
if (input.length() < 2)
continue;

st = new StringTokenizer(input);
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
int c = Integer.parseInt(st.nextToken());

if (n == 0 && m == 0 && c == 0)
return;

System.out.println(((m - 7) * (n - 7) + c) / 2);
}
}
}