ccf 画图

qwq这个题很简单的遍历标记就完事了

我的菜鸡满分代码:

 1 /*
 2 * @Author: tp
 3 * @Date:   2019-11-23 15:47:47
 4 * @Last Modified by:   tp
 5 * @Last Modified time: 2019-11-23 16:08:11
 6 */
 7 #include <cstdio>
 8 #include <iostream>
 9 #include <cstdlib>
10 #include <cmath>
11 #include <string>
12 #include <cstring>
13 #include <algorithm>
14 #include <stack>
15 #include <queue>
16 #include <set>
17 #include <map>
18 #include <ctime>
19 #include <vector>
20 #include <list>
21 using namespace std;
22 typedef long long ll;
23 typedef unsigned long long ull;
24 int a[101][101];
25 int main() 
26 {
27     int n;
28     cin>>n;
29     for (int i = 0; i < n; ++i)
30     {
31         int x,y,ex,ey;
32         cin>>x>>y>>ex>>ey;
33         for (int j=min(x,ex)+1;j<=max(x,ex);++j)
34         {
35             for(int k=min(y,ey)+1;k<=max(y,ey);++k)
36                 a[j][k]=2;
37         }
38     }
39     int ans=0;
40     for (int i = 1; i < 101; ++i)
41     {
42         for(int j=1;j<101;j++)
43             if(a[i][j]==2)
44                 ans++;
45     }
46 
47     cout<<ans<<endl;
48     return 0;
49 }
50 /*
51 2
52 1 1 4 4
53 2 3 6 5
54 */
View Code
原文地址:https://www.cnblogs.com/tp25959/p/11918424.html