Pagini recente » Cod sursa (job #2455110) | Cod sursa (job #2455109) | Monitorul de evaluare | Cod sursa (job #1061684) | Cod sursa (job #2448147)
/*
* 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.*;
import java.util.*;
/**
*
* @author dakata
*/
class Puncte {
double x;
double y;
public Puncte(double x, double y) {
this.x = x;
this.y = y;
}
}
public class Main {
/**
* @param args the command line arguments
*/
/*
public static void main(String[] args) throws FileNotFoundException {
// TODO code application logic here
Scanner scanner = new Scanner(new FileInputStream("adunare.in"));
PrintStream writer = new PrintStream("adunare.out");
int a = Integer.parseInt(scanner.nextLine());
int b = Integer.parseInt(scanner.nextLine());
writer.println(a+b);
}
*/
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader(String f) throws FileNotFoundException {
br = new BufferedReader(new FileReader(f));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
public static void main(String[] args) throws FileNotFoundException, IOException {
FastReader fr = new FastReader("aria.in");
PrintStream writer = new PrintStream("aria.out");
double sum = 0;
int N = Integer.parseInt(fr.nextLine());
Puncte[] puncte = new Puncte[N + 1];
for (int i = 0; i < N; i++) {
puncte[i] = new Puncte(fr.nextDouble(), fr.nextDouble());
}
puncte[N] = puncte[0];
for (int i = 0; i < N; i++) {
sum += puncte[i].x * puncte[i + 1].y - puncte[i + 1].x * puncte[i].y;
}
writer.printf("%.5f\n", sum / 2);
}
}