小明上学
Java满分代码
Java代码
import java.util.Scanner;
public class Main {
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int r = sc.nextInt();
int y = sc.nextInt();
int g = sc.nextInt();
int res = 0;
int n = sc.nextInt();
for(int i = 0;i < n;i++){
int light = sc.nextInt();
int time = sc.nextInt();
if(light != 3)
res += time;
if(light == 2)
res += r;
}
System.out.println(res);
}
}