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);
}
}
}
}