Educational Codeforces Round 26 C. Two Seals
来源:互联网 发布:linux 终端切换 编辑:程序博客网 时间:2024/05/23 15:39
题目网址: Educational Codeforces Round 26 C. Two Seals
题意分析:
题意:
- 就是求取出两个矩形放在已知的矩形区域内, 使得找出的这两个矩形占的面积最大
- 粗暴一点… 把八种情况都写了..
代码:
#include <bits/stdc++.h>using namespace std;const int SIZE = 105;pair<int, int> point[SIZE];int main(int argc, char const *argv[]){ int n, a, b; int x, y; while (~scanf("%d %d %d", &n, &a, &b)) { for (int i = 0; i < n; ++i) { scanf("%d %d", &x, &y); point[i] = make_pair(x, y); } int MAX = 0; for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { if (point[i].first + point[j].first <= a \ && point[i].second <= b\ && point[j].second <= b) { MAX = max(MAX, point[i].first*point[i].second \ + point[j].first*point[j].second); } if(point[i].first + point[j].second <= a \ && point[i].second <= b \ && point[j].first <= b) { MAX = max(MAX, point[i].first*point[i].second \ + point[j].first*point[j].second); } if (point[i].first + point[j].first <= b \ && point[i].second <= a\ && point[j].second <= a) { MAX = max(MAX, point[i].first*point[i].second \ + point[j].first*point[j].second); } if(point[i].first + point[j].second <= b \ && point[i].second <= a \ && point[j].first <= a) { MAX = max(MAX, point[i].first*point[i].second \ + point[j].first*point[j].second); } // 5 if (point[i].second + point[j].first <= a \ && point[i].first <= b\ && point[j].second <= b) { MAX = max(MAX, point[i].first*point[i].second \ + point[j].first*point[j].second); } if(point[i].second + point[j].second <= a \ && point[i].first <= b \ && point[j].first <= b) { MAX = max(MAX, point[i].first*point[i].second \ + point[j].first*point[j].second); } if (point[i].second + point[j].first <= b \ && point[i].first <= a\ && point[j].second <= a) { MAX = max(MAX, point[i].first*point[i].second \ + point[j].first*point[j].second); } if(point[i].second + point[j].second <= b \ && point[i].first <= a \ && point[j].first <= a) { MAX = max(MAX, point[i].first*point[i].second \ + point[j].first*point[j].second); } } } printf("%d\n", MAX); } return 0;}
阅读全文
0 0
- Educational Codeforces Round 26 C. Two Seals
- Educational Codeforces Round 26 C. Two Seals
- Educational Codeforces Round 26 C. Two Seals
- Educational Codeforces Round 26:C. Two Seals
- cf Educational Codeforces Round 26 C. Two Seals
- 【Codeforces 837C. Two Seals】
- Educational Codeforces Round 11 C (Two Pointers)
- Educational Codeforces Round 17-C Two strings
- Educational Codeforces Round 26 C
- [Educational Codeforces Round 17 C (762C)] Two strings
- Educational Codeforces Round 17 C. Two strings(二分)
- Educational Codeforces Round 27 C. Two TVs(模拟)
- Educational Codeforces Round 26 A—C
- Educational Codeforces Round 26
- Educational Codeforces Round 26
- Educational Codeforces Round 17 C && codeforces 762C C. Two strings(前缀后缀的妙用)
- Educational Codeforces Round 21 C
- Educational Codeforces Round 5 C
- maven 介绍
- PAT basic 1029
- PAT basic 1030
- 机器学习集训营---第四周总结
- Java菜鸟教程 一些简单的练习
- Educational Codeforces Round 26 C. Two Seals
- 瞬时态、持久态、脱管态
- python 學習的一些心得分享(基礎)
- Java 异常总结
- Unity3D
- DNS (域名系统)
- C#中修改exe图标
- Future+Callable提供系统吞吐量
- HDU1530:Maximum Clique(最大团)