1.

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

/**
* Angewandte Mathematik, SS11
* Problem: 913 - Joana and the Odd Numbers
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=854
*
* @author Unverzart Michael
* @author Wurth Manuel
* @version 1.0, 11/4/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.108
*/

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)
{
int n = new Integer(inputLine);
if(n%2!=0){
long a = BigInteger.valueOf(n+1).pow(2).longValue()/2-1;
System.out.println(a*3-6);
}

}
}
}

2.

/**
* Angewandte Mathematik, SS11
* Problem: 913 Joana and the Odd Numbers
* Link: http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=854
*
* @author Georg Weber, Daniel Brielbeck
* @version 1.0, 03/05/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));

long n, m, p, num;
long sum_tot, sum_even, tot_sum, lst3_sum, lst_trm;
String input;
while ((input = reader.readLine()) != null)
{
num = Integer.valueOf(input);
n = num - 2;
m = n - 1;
p = m / 2;
sum_tot = n * (n + 1) / 2;
sum_even = p * (p + 1);
tot_sum = sum_tot - sum_even;
tot_sum *= 2;
lst_trm = (tot_sum + 2 * num) - 1;
lst3_sum = (3 * lst_trm) - 6;
System.out.println(lst3_sum);
}
}

}

-----------------------------------------------------------


1.
/*
* ACM Contest training
* Problem: 913 Joana and the Odd Numbers
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=854
*
* @author Christoph Göttschkes
* @version 1.0, 10/20/2010
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.084
*/

import java.io.*;

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

long number = Long.parseLong(reader.readLine());

while (reader.ready()) {

System.out.println(calc(number));

number = Long.parseLong(reader.readLine());
}
System.out.println(calc(number));
}

public static long calc(long line) {
line = (line + 1) >> 1;
return (((line*line) << 1) - 1) * 3 - 6;
}
}


2.
/** * FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* * Problem: 913 - Joana and the Odd Numbers
* * Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=854
* * Savkina Ekaterina
* * @version 1.0, 29/04/2010
* * Status : Accepted
* * Runtime: 0.128 */
package odd;

import java.math.BigInteger;
import java.util.Scanner;

public class Odd {
public static void main(String... args) {
Scanner sc = new Scanner(System.in);
BigInteger sum = new BigInteger("0");
while (sc.hasNext()) {
int count = sc.nextInt();
if (count == 0)
System.out.println(1);
else {
count = count / 2 + 1;
BigInteger co = BigInteger.valueOf(count);
sum = co.add(BigInteger.ONE).multiply(co).subtract(co)
.multiply(BigInteger.valueOf(2)).subtract(
BigInteger.ONE).multiply(BigInteger.valueOf(3))
.subtract(BigInteger.valueOf(6));
System.out.println(sum);
}
}
}
}