题目链接:
计算机软件能力认证考试系统http://118.190.20.162/view.page?gpid=T123
【分析】这是一道朴实无华的模拟题了,跟着题意求和就行了。
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int i, sum = 0, a, b;
for(i = 0; i < n; i++){
a = scanner.nextInt();
b = scanner.nextInt();
sum += a * b;
}
if(sum < 0) sum = 0;
System.out.println(sum);
}
}