解题思路:
注意事项:
参考代码:
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class C1546 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { Map<String, Integer> map = new HashMap<String, Integer>(); int N = sc.nextInt(); for(int i = 0; i < N; i++) map.put(sc.next(), 0); int M = sc.nextInt(); for(int i = 0; i < M; i++){ int score = 0; String name = ""; int scoreDaDa = 0; for(int j = 0; j < N; j++){ score = sc.nextInt(); name = sc.next(); score += map.get(name); map.put(name, score); if("DaDa".equals(name)){ scoreDaDa = score; } } int count = 1; for(String key : map.keySet()){ if(map.get(key) > scoreDaDa) count++; } System.out.println(count); } } sc.close(); } }
0.0分
2 人评分