1. 

/**
* 11219 - How old are you?
*
* Studiengruppe: IFB2C
*
* Robert Reichart
* Elvin Uzeirovic
* Martin Pesl
*
* Run Time Submission Date
* 0.160 2009-04-22 14:38:00
*/

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


class Main {

public static void main(String... args) throws IOException{
Main a = new Main();
}

Main() throws IOException{
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
int parts = Integer.parseInt(input.readLine());
for (int i = 1; i <= parts; i++) {
input.readLine();

String[] Date ;
int[] DateCur = new int[3];
int[] DateBirth = new int[3];

Date = input.readLine().split("/");
for(int k = 0; k < 3; k++){
DateCur[k] = Integer.parseInt(Date[k]);

}
Date = input.readLine().split("/");
for(int k = 0; k < 3; k++){
DateBirth[k] = Integer.parseInt(Date[k]);

}

//ausrechnen des alters wenn DateCur nach DateBirth liegt
if(DateCur[2] > DateBirth[2] ||
(DateCur[2] == DateBirth[2] && DateCur[1] > DateBirth[1]) ||
(DateCur[2] == DateBirth[2] && DateCur[1] == DateBirth[1] && DateCur[0] >= DateBirth[0])) {

int age = DateCur[2] - DateBirth[2];

if(DateCur[1] < DateBirth[1]){
age--;
}else if(DateCur[1] == DateBirth[1] &&
DateCur[0] < DateBirth[0]) {
age--;
}
if(age > 130){
System.out.println("Case #" + i + ": Check birth date");
} else {
System.out.println("Case #" + i + ": " + age);
}
} else {
System.out.println("Case #" + i + ": Invalid birth date");
}
}
}
}

2.

/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #11219 - How old are you?
* Link:
http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2160
*
* @author Mohr
* @author Schirm
* @author Mathauser
* @version 1.0, 04/23/2009
*
* Status : Accepted
* Runtime: 0.170
*/

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

public static int calcYears(long between, int[] birthDate) {
int age = 0;

// Geboren nach Februar -> Schaltjahrcheck aufs nächste Jahr stellen
if (birthDate[1] > 2)
birthDate[2] += 1;

boolean SchaltJahr = Schaltjahr(birthDate[2]);

while((SchaltJahr && between >= 366) || (!SchaltJahr && between >=
365)) {
if (SchaltJahr)
between -= 366;
else
between -=365;
age++;
birthDate[2]++;
SchaltJahr = Schaltjahr(birthDate[2]);
}

return age;

}
public static long daysBetween(int[] start, int[] end) {
long startDays = start[0];
long endDays = end[0];

// Jahre: Geburtsdatum
if (start[2] > end[2])
for(int i = end[2] ; i < start[2]; i++)
startDays += (Schaltjahr(i)) ? 366 : 365;

// Jahre: aktuelles Datum
if (start[2] < end[2])
for(int i = start[2] ; i < end[2]; i++)
endDays += (Schaltjahr(i)) ? 366 : 365;

// Monate: Geburtsdatum
if (start[1] > end[1])
for(int i = end[1] ; i < start[1]; i++)
if(i == 2)
startDays += (Schaltjahr(start[2])) ? 29 : 28;
else
if(i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i
== 10)
startDays += 31;
else
startDays += 30;

// Monate: aktuelles Datum
if (start[1] < end[1])
for(int i =start[1] ; i < end[1]; i++)
if(i == 2)
endDays += (Schaltjahr(end[2])) ? 29 : 28;
else
if(i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i
== 10)
endDays += 31;
else
endDays += 30;

// Anzahl der Tage zwischen aktuellen Datum und Geburtsdatum
return endDays - startDays;
}

public static boolean Schaltjahr(int jahr) {

if( jahr % 4 == 0 && (jahr % 100 != 0 || jahr % 400 == 0))
// Durch 4, nicht durch 100 aber durch 400 teilbar
return true;

return false;
}




public static void main(String...args) throws Exception{

BufferedReader reader = new BufferedReader(new
InputStreamReader(System.in));
String line = reader.readLine(); // Anzahl der Testfälle
int count = Integer.parseInt(line);
for(int i = 1; i <= count; i++){
reader.readLine(); // Leer

String aktDate = reader.readLine(); // aktuelles Datum
String[] arrAktDate = aktDate.split("/");

int[] intAktDate = new int[3];
intAktDate[0] = Integer.parseInt(arrAktDate[0]);
intAktDate[1] = Integer.parseInt(arrAktDate[1]);
intAktDate[2] = Integer.parseInt(arrAktDate[2]);

String birthDate = reader.readLine(); // Geburtsdatum
String[] arrBirthDate = birthDate.split("/");

int[] intBirthDate = new int[3];
intBirthDate[0] = Integer.parseInt(arrBirthDate[0]);
intBirthDate[1] = Integer.parseInt(arrBirthDate[1]);
intBirthDate[2] = Integer.parseInt(arrBirthDate[2]);

// Tage zwischen aktuellen und Geburtsdatum
long between = daysBetween(intBirthDate, intAktDate);

if(between < 0)
System.out.println("Case #"+i+": Invalid birth date");
else {
// Alter
int age = calcYears(between, intBirthDate);

if (age > 130)
System.out.println("Case #"+i+": Check birth date");
else
System.out.println("Case #"+i+": "+age);
}

}

}
}


3.


/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem: How old are you? (11219)
* @author Christian Mitterreiter
* @author Rolf Luigs
* @version 1.0, 04/23/2009
* Status : Accepted
* Runtime: 0.220
*/


import java.util.*;
import java.io.*;

public class Main {

@SuppressWarnings("deprecation")
public static void main(String[] args)throws IOException {

BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st ;
int[] input = new int [100000];
int k=0;
input[0]=1;
for(;k<input[0]*6-1;)
{
String s = is.readLine();
st = new StringTokenizer(s);
while (st.hasMoreTokens())
{
String ss = st.nextToken();
try {
String[]sss=ss.split("/");
for (int j=0;j<sss.length;k++,j++)
input[k]=Integer.parseInt(sss[j]);
}
catch (Exception e)
{
input[k]=Integer.parseInt(ss);
k++;
}
}
}

for (int i=1,j=1;i<k;i+=6,j++)
{
System.out.print("Case #"+j+": ");
Date ist =new Date(input[i+2]-1900, input[i+1]-1, input[i+0]);
Date war =new Date(input[i+5]-1900, input[i+4]-1, input[i+3]);
if(war.after(ist))
System.out.println("Invalid birth date");
else{
int jahr = ist.getYear()-war.getYear();
if (ist.getMonth()==war.getMonth()&&ist.getDate()< war.getDate())
jahr--;
if (ist.getMonth()<war.getMonth())
jahr--;

if (jahr>130)
System.out.println("Check birth date");
else
System.out.println(jahr);

}

}

}

}