1. Title Description: Click to open the link
2. Problem-solving ideas: The subject is a simple simulation, each time scanning an input rectangle, and then the interior all points are +1, the final statistical array of all elements and can.
3. Code:
#define _crt_secure_no_warnings#include<iostream> #include <algorithm> #include <string> #include <sstream> #include <set> #include <vector> #include <stack> #include <map> #include < queue> #include <deque> #include <cstdlib> #include <cstdio> #include <cstring> #include < cmath> #include <ctime> #include <functional>using namespace std;typedef long Long ll;typedef unsigned Long long ull; #define ME (s) memset (s,0,sizeof (s)) #define for (i,n) for (int i=0;i< (n); i++) #define PB Push_back#define SZ size#define CLR Clear#define F (A, b) for (int i=a;b;i++) const int N=110;int a[n][n];int Main () {int N; while (~SCANF ("%d", &n)) {Me (a); int x1,x2,y1,y2; while (n--) {scanf ("%d%d%d%d", &x1,&y1,&x2,&y2); for (int i=y1;i<=y2;i++) for (int j=x1;j<=x2;j++) a[i][j]++; } int ans=0; for (int i=1;i<=100;i++) for (int j=1;j<=100;j++) ANS+=A[I][J]; printf ("%d\n", ans); } return 0;}
#308 (Div.2) A. Vanya and Table