UVA 10300 – Ecological Premium

This was super easy. No need for doubles like I had initially thought.

import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 
 * @author Sanchit M. Bhatnagar
 * @see http://uhunt.felix-halim.net/id/74004
 * 
 */
public class P10300 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int N = sc.nextInt();
		while (N > 0) {
			int f = sc.nextInt();
			long ans = 0;
			for (int i = 0; i < f; i++) {
				int sizeOfFarm = sc.nextInt();
				sc.nextInt();
				int eco = sc.nextInt();
				ans += sizeOfFarm * eco;
			}
			out.println(ans);
			N--;
		}

		out.close();
		sc.close();
	}

}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.