Codeforces Round #308 (Div. 2) A. Vanya and Table
原题:http://codeforces.com/contest/552/problem/A
题目大意: 给[1,100]个格子, n个矩阵, 问n个矩阵覆盖格子的合是多少?
分析: 乘一下就出来了
public void solve(int testNumber, InputReader in, OutputWriter out) { int n = in.readInt(); int res = 0; for (int i = 0; i < n; i++) { int x1 = in.readInt(); int y1 = in.readInt(); int x2 = in.readInt(); int y2 = in.readInt(); res += (x2-x1+1) * (y2-y1+1); } out.print(res); }
Leave A Comment