-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrassseed.java
More file actions
34 lines (27 loc) · 926 Bytes
/
Copy pathgrassseed.java
File metadata and controls
34 lines (27 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.lang.Math;
import java.lang.Integer;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Scanner;
public class grassseed {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
DecimalFormat precision6 = new DecimalFormat("0.000000");
double c = input.nextDouble();
int l = input.nextInt();
double[] w = new double[l];
double[] l2 = new double[l];
for (int i = 0; i < l; i++) {
w[i] = input.nextDouble();
l2[i] = input.nextDouble();
}
double ans = 0;
for (int i = 0; i < l; i++) {
ans = ans + c * w[i] * l2[i];
}
System.out.print(precision6.format(ans));
}
static int pow(double n, double p) {
return (int)Math.pow(n, p);
}
}