#308 (Div.2) A. Vanya and Table

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.