标签:exti static stat next import for blank system tin
http://codeforces.com/contest/500/problem/C
模拟
1 import java.util.Scanner; 2 3 public class Main { 4 5 public static void main(String[] args) { 6 Scanner io = new Scanner(System.in); 7 int n = io.nextInt(), m = io.nextInt(); 8 int[] w = new int[n + 1], b = new int[n + 1]; 9 for (int i = 1; i <= n; i++) { 10 w[i] = io.nextInt(); 11 b[i] = -1; 12 } 13 int ans = 0; 14 for (int i = 0, a; i < m; i++) { 15 a = io.nextInt(); 16 for (int j = 1; j <= n; j++) if (b[j] > b[a]) ans += w[j]; 17 b[a] = i; 18 } 19 System.out.println(ans); 20 } 21 22 }
标签:exti static stat next import for blank system tin
原文地址:https://www.cnblogs.com/towerbird/p/11410177.html