康斯坦丁_s:public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String[] split = in.nextLine().split(" ");
int N = Integer.parseInt(split[0]);
int E = Integer.parseInt(split[1]);
int curX = 0, curY = 0, area = 0;
for (int i = 0; i < N; i++) {
String[] strs = in.nextLine().split(" ");
int x = Integer.parseInt(strs[0]);
int y = Integer.parseInt(strs[1]);
area += (x - curX) * Math.abs(curY);
curX = x;
curY += y;
}
if (curX < E) {
area += (E - curX) * Math.abs(curY);
}
System.out.println(area);
in.close();
}

0 点赞 评论 收藏
分享
创作者周榜
更多
关注他的用户也关注了: