HDU2555(模拟暴力)
来源:互联网 发布:小米网络摄像头怎么用 编辑:程序博客网 时间:2024/05/22 13:59
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2555
解题思路:
对每个人都检查一遍他是否扔到了陷阱里,扔到了就加上相应的周长。最后从大到小排个序输出。
完整代码:
#include <functional>#include <algorithm>#include <iostream>#include <fstream>#include <sstream>#include <iomanip>#include <numeric>#include <cstring>#include <climits>#include <cassert>#include <complex>#include <cstdio>#include <string>#include <vector>#include <bitset>#include <queue>#include <stack>#include <cmath>#include <ctime>#include <list>#include <set>#include <map>using namespace std;#pragma comment(linker, "/STACK:102400000,102400000")typedef long long LL;typedef double DB;typedef unsigned uint;typedef unsigned long long uLL;/** Constant List .. **/ //{const int MOD = int(1e9)+7;const int INF = 0x3f3f3f3f;const LL INFF = 0x3f3f3f3f3f3f3f3fLL;const DB EPS = 1e-9;const DB OO = 1e20;const DB PI = acos(-1.0); //M_PI;const int maxn = 30001;int b[maxn];struct node{ int x , y;}k[maxn];struct node2{ int x1 , x2 , y1 , y2;}k2[maxn];bool cmp(int a ,int b){ return a > b;}int main(){ #ifdef DoubleQ freopen("in.txt","r",stdin); #endif std::ios::sync_with_stdio(false); std::cin.tie(0); int n , m; while(cin >> n >> m) { for(int i = 0 ; i < n ; i ++) { cin >> k[i].x >> k[i].y ; } for(int i = 0 ; i < m ; i ++) { cin >> k2[i].x1 >> k2[i].y1 >> k2[i].x2 >> k2[i].y2; } memset(b , 0 , sizeof(b)); for(int i = 0 ; i < n ; i ++) { for(int j = 0 ; j < m ; j ++) { if( k[i].x >= k2[j].x1 && k[i].x <= k2[j].x2 && k[i].y >= k2[j].y1 && k[i].y <= k2[j].y2 ) { b[i] += 2 * (abs(k2[j].x1 - k2[j].x2) + abs(k2[j].y1 - k2[j].y2) ); break; } } } sort(b , b + n , cmp); for(int i = 0 ; i < n ; i ++) cout << b[i] << endl; }}
0 0
- HDU2555(模拟暴力)
- HLJUOJ1117(暴力模拟)
- HDU6168(暴力模拟)
- HDU 1022(栈模拟;暴力搜索)
- UVALive 6089 Nine (暴力模拟)
- #1039 : 字符消除(模拟+暴力+递归)
- CodeForces 549D (暴力、模拟)
- hdu 5386 Cover (逆向暴力模拟)
- UVA - 201 Squares(模拟 + 暴力)
- hdoj--1432--Lining Up(暴力模拟)
- Landoj 1603 - Minimum Sum (暴力&模拟)
- ZOJ 3944 People Counting(模拟+暴力)
- HDU 4608 I-number(暴力模拟)
- CodeForces612AThe Text Splitting(模拟,暴力枚举)
- HDU5908 Abelian Period(模拟暴力)
- UVa11994 快乐涂色(暴力模拟)
- C. Dasha and Password(模拟,暴力)
- Break Standard Weight(模拟,暴力)
- C-----------------LessonPointerHigher
- 低功耗蓝牙4.0BLE编程-nrf51822开发(3)
- 梯度下降算法
- C#读取txt的指定行
- java开发中常用插件三----blockui
- HDU2555(模拟暴力)
- C语言的malloc()和free()函数原理
- 如何使用Oracle FND_LOAD工具在不同Instance间同步数据(Example)
- Servlet3.0-使用注解定义Servlet
- [Linux起步]配置Java和Eclipse环境
- 马尔科夫链
- Unity3D—transform和Input
- 网络编程之WCF编程:WCF服务和客户端的建立,回调
- Unity之Transform和Input