当前位置:网站首页>CCF drawing (full mark code + problem solving ideas + skill summary) February 2, 2014
CCF drawing (full mark code + problem solving ideas + skill summary) February 2, 2014
2022-06-30 14:41:00 【A cute little monkey】
Title Description
Their thinking
Because the data range is very small , So it can be solved directly
It is equivalent to marking all colored points on a square grid paper
Finally, count all colored points
Code implementation
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 110;
int n;
bool m[N][N];
int main()
{
cin >> n;
while(n --)
{
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
for (int i = x1; i < x2; i ++)
{
for (int j = y1; j < y2; j ++)
{
m[i][j] = true;
}
}
}
int res = 0;
for (int i = 0; i < N; i ++)
{
for (int j = 0; j < N; j ++)
{
res += m[i][j];
}
}
cout << res;
return 0;
}
Skill summary
- Data range is important , First of all, think about the most stupid act of violence , When the data range is not allowed , Think again about the algorithm for optimization
- Don't solve problems in a proper way , for example : My inherent thinking in this problem is to add large areas , Subtract coincident area , Then I don't know how to judge the weight … It's going to crash …
- If the data range is relatively small, we must think about the violent solution !!
边栏推荐
- PS tip: the video frame to Layer command cannot be completed because dynamiclink is not available
- 【BUUCTF】 EasySql
- Finding the median of two arrays by dichotomy
- Double pointer circular linked list
- Clear the route cache in Vue
- Three uses of golang underscores
- V3 02——What‘s new in Chrome extensions
- On simple code crawling Youdao translation_ 0's problem (to be solved)
- Greedy interval problem (5)
- Small exercise of process and signal
猜你喜欢
How does hbuilder display in columns?
go time. after
Computer screenshot how to cut the mouse in
PS cutting height 1px, Y-axis tiling background image problem
KnightCTF WEB
I love network security for new recruitment assessment
@PathVariable
Race of golang
The first dark spring cup dnuictf
Detailed explanation of the first three passes of upload Labs
随机推荐
Hbuilder most commonly used and full shortcut key set
JS to realize simple lottery function
Invalid argument during startup: Failed to open the . conf file: redis-window
Greedy interval problem (5)
JS array sorting method summary
Advanced usage of go language for loop break and continue
Complete TCP forwarding server (kernel linked list + mutex)
Solution cannot use a scalar value as an array
How does hbuilder display in columns?
Vue returns to the previous page without refreshing the page / Vue caches the page
@PathVariable
[buuctf] [actf2020 freshman competition]include
Ctfshow getting started with the web (ThinkPHP topic)
go channel && select
Alipay certificate mode payment interface
Not satisfied with markdown native code block style? Try this beautify code screenshot tool~~
Pseudocode writing specification
PS dynamic drawing
Logiciel de récupération de données easyrecovery15 téléchargement
@ResponseBody的作用