核心思想
模拟就完了
代码
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int m = scanner.nextInt();
Long[] res = new Long[m + 1];
Arrays.fill(res, 0L);
LinkedList<Integer> q= new LinkedList<>();
for(int i = 1; i <= n; i++){
int k = scanner.nextInt();
int c = scanner.nextInt();
for(int j = 1; j <= k - 1; j++){
q.add(scanner.nextInt());
}
int x = (int) Math.ceil(1.0 * c / k);
while (!q.isEmpty()){
int cur = q.pollFirst();
res[cur] += x;
}
}
for(int i = 1; i <= m; i++){
if(i == 1)
System.out.print(res[i]);
else
System.out.print(" "+res[i]);
}
}
}
标签:scanner,真题,int,届秋招,Long,new,第三场
From: https://www.cnblogs.com/ganyq/p/18110043