Pagini recente » Cod sursa (job #1098490) | Cod sursa (job #2190610) | Cod sursa (job #1792375) | Cod sursa (job #1596115) | Cod sursa (job #2448116)
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.Scanner;
/**
*
* @author dakata
*/
class Main {
public static void main(String[] args) throws FileNotFoundException {
Scanner scanner = new Scanner(new FileInputStream("aria.in"));
PrintStream writer = new PrintStream("aria.out");
String line_1 = "";
String line_2 = "";
String[] cuv;
String[] cuv_2;
int sum = 0;
int N = Integer.parseInt(scanner.nextLine());
for (int i = 0; i < N / 2; i++) {
line_1 = scanner.nextLine();
line_2 = scanner.nextLine();
cuv = line_1.split(" ");
cuv_2 = line_2.split(" ");
sum += Integer.parseInt(cuv[0]) * Integer.parseInt(cuv_2[1]) - Integer.parseInt(cuv_2[0]) * Integer.parseInt(cuv[1]);
}
if (N % 2 == 1) {
line_1 = line_2;
line_2 = scanner.nextLine();
cuv_2 = line_2.split(" ");
cuv = line_1.split(" ");
sum += Integer.parseInt(cuv[0]) * Integer.parseInt(cuv_2[1]) - Integer.parseInt(cuv_2[0]) * Integer.parseInt(cuv[1]);
}
writer.println(sum);
}
}