mirror of
https://github.com/wczffl-503/OI-Codes.git
synced 2025-05-10 16:20:27 +08:00
Update XSM OJ
This commit is contained in:
parent
2fe17ab3fd
commit
8f564ca60e
27
XSM OJ 重庆小码王集团OJ/【蓝桥杯省赛】分乘整数.cpp
Normal file
27
XSM OJ 重庆小码王集团OJ/【蓝桥杯省赛】分乘整数.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
#define int long long
|
||||
using namespace std;
|
||||
|
||||
signed main()
|
||||
{
|
||||
int N;
|
||||
cin >> N;
|
||||
|
||||
int count = 0;
|
||||
|
||||
for (int i = 1; i <= N / 3; ++i)
|
||||
{
|
||||
for (int j = i + 1; j <= N / 2; ++j)
|
||||
{
|
||||
int k = N - i - j;
|
||||
if (k > j && k != 3 && k != 7 && i != 3 && i != 7 && j != 3 && j != 7 && k != 0)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cout << count << endl;
|
||||
|
||||
return 0;
|
||||
}
|
35
XSM OJ 重庆小码王集团OJ/【蓝桥杯省赛】面积.cpp
Normal file
35
XSM OJ 重庆小码王集团OJ/【蓝桥杯省赛】面积.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct Rectangle {
|
||||
int x1, y1, x2, y2;
|
||||
};
|
||||
|
||||
int main() {
|
||||
int n;
|
||||
cin >> n;
|
||||
|
||||
vector<Rectangle> rectangles(n);
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
cin >> rectangles[i].x1 >> rectangles[i].y1 >> rectangles[i].x2 >> rectangles[i].y2;
|
||||
}
|
||||
|
||||
int totalArea = 0;
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
totalArea += (rectangles[i].x2 - rectangles[i].x1) * (rectangles[i].y2 - rectangles[i].y1);
|
||||
|
||||
for (int j = i + 1; j < n; ++j) {
|
||||
int x_overlap = max(0, min(rectangles[i].x2, rectangles[j].x2) - max(rectangles[i].x1, rectangles[j].x1));
|
||||
int y_overlap = max(0, min(rectangles[i].y2, rectangles[j].y2) - max(rectangles[i].y1, rectangles[j].y1));
|
||||
totalArea -= x_overlap * y_overlap;
|
||||
}
|
||||
}
|
||||
|
||||
cout << totalArea << endl;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user