Pagini recente » Cod sursa (job #2455047) | Cod sursa (job #2248529) | Istoria paginii runda/123abc/clasament | Cod sursa (job #1812749) | Cod sursa (job #2448198)
/*
* 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());
double[] v = new double[2 * N + 2];
for (int i = 0; i < 2 * N; i += 2) {
v[i] = fr.nextDouble();
v[i + 1] = fr.nextDouble();
}
v[2 * N] = v[0];
v[2 * N + 1] = v[1];
System.out.println("");
for (int i = 0; i < v.length - 2; i += 2) {
sum += v[i] * v[i + 3] - v[i + 1] * v[i + 2];
}
writer.printf("%.5f\n", sum / 2);
}
}