Click Here to go back to the homepage.

Grass Seed Inc. Solution:


import java.util.*;

public class Kattis {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double costPerSQMeter = Double.parseDouble(sc.nextLine());
        int lawns = Integer.parseInt(sc.nextLine());
        double total= 0;
        for(int i = 0; i < lawns; i++){
            String[] split = sc.nextLine().split(" ");
            total += (costPerSQMeter * (Double.parseDouble(split[0]) * Double.parseDouble(split[1])));
        }
        System.out.println(total);
    }
}