题意:给定一条线段,让你求一条线段与已知线段垂直,并且所有线段的坐标的点的坐标都不大于给定的坐标的最大值且不能为负数。

析:没啥好说的,随便找一条就好。

代码如下:

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
#include <cmath>
#include <stack>
//#include <tr1/unordered_map>
#define freopenr freopen("in.txt", "r", stdin)
#define freopenw freopen("out.txt", "w", stdout)
using namespace std;
//using namespace std :: tr1; typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const LL LNF = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 2500 + 5;
const LL mod = 10000000000007;
const int N = 1e6 + 5;
const int dr[] = {-1, 0, 1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1};
const char *Hex[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
inline LL gcd(LL a, LL b){ return b == 0 ? a : gcd(b, a%b); }
int n, m;
const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline int Min(int a, int b){ return a < b ? a : b; }
inline int Max(int a, int b){ return a > b ? a : b; }
inline LL Min(LL a, LL b){ return a < b ? a : b; }
inline LL Max(LL a, LL b){ return a > b ? a : b; }
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
} int main(){
int x1, y1, x2, y2, T;
cin >> T;
for(int kase = 1; kase <= T; ++kase){
cin >> x1 >> y1 >> x2 >> y2;
m = 0;
m = Max(m, x1); m = Max(m, y1);
m = Max(m, x2); m = Max(m, y2);
int x = x2 - x1;
int y = y2 - y1;
int xx = -y, yy = x;
int xxx = xx + x1, yyy = yy + y1;
if(xxx < 0){
x1 -= xxx;
xxx = 0;
}
if(yyy < 0){
y1 -= yyy;
yyy = 0;
}
if(xxx > m){
x1 += (m - xxx);
xxx = m;
}
if(yyy > m){
y1 += (m - yyy);
yyy = m;
}
printf("Case %d: %d %d %d %d\n", kase, x1, y1, xxx, yyy); }
return 0;
}

UVa 12714 Two Points Revisited (水题,计算几何)的更多相关文章

  1. UVa 11636 Hello World! (水题思维)

    题意:给你一个数,让你求需要复制粘贴多少次才能达到这个数. 析:这真是一个水题,相当水,很容易知道每次都翻倍,只要大于等于给定的数就ok了. 代码如下: #include <iostream&g ...

  2. POJ1151 Atlantis 水题 计算几何

    http://poj.org/problem?id=1151 想学一下扫描线线段树,结果写了道水题. #include<iostream> #include<cstdio> # ...

  3. uva 489 Hangman Judge(水题)

    题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&am ...

  4. uva 10252 - Common Permutation 字符串水题

    题意:給定兩個小寫的字串a與b,請印出皆出現在兩字串中的字母,出現的字母由a~z的順序印出,若同字母出現不只一次,請重複印出但不能超過任一字串中出現的次數.(from Ruby兔) 很水,直接比较输出 ...

  5. UVa 10340 - All in All 水题 难度: 0

    题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...

  6. UVA 11947 Cancer or Scorpio 水题

    Cancer or Scorpio Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://uva.onlinejudge.org/index.php? ...

  7. UVA 11100 The Trip, 2007 水题一枚

    题目链接:UVA - 11100 题意描述:n个旅行箱,形状相同,尺寸不同,尺寸小的可以放在尺寸大的旅行箱里.现在要求露在最外面的旅行箱的数量最少的同时满足一个旅行箱里放的旅行箱的数量最少.求出这样满 ...

  8. UVA 11461 - Square Numbers 数学水题

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  9. uva 11059 maximum product(水题)——yhx

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAB1QAAAMcCAIAAABo0QCJAAAgAElEQVR4nOydW7msuhKF2wIasIAHJK

随机推荐

  1. 如何改变linux系统的只读文件的权限

    vim 编辑可以在命令模式输入 :wq! 保存退出可以用chmod 命令修改文件权限. chmod命令是非常重要的,用于改变文件或目录的访问权限.用户用它控制文件或目录的访问权限.该命令有两种用法.一 ...

  2. 三、fs文件操作模块

    fs模块用于文件的读写等操作. 该模块有如下这些方法: 1.fs.stat() : 检测是文件还是目录 const fs = require('fs'); fs.stat('test.html',fu ...

  3. 2017-10-04-afternoon

    注意完全平方数统计时的特判 #include <cstdio> inline void read(int &x) { x=; register char ch=getchar(); ...

  4. <项目><day12>通讯录(自己做的)

    设计一个通讯录主页面 <!DOCTYPE html> <html> <head> <title>电话本首页</title> <meta ...

  5. Java异常错误重试方案研究(转)(spring-retry/guava-retryer)

    业务场景 应用中需要实现一个功能: 需要将数据上传到远程存储服务,同时在返回处理成功情况下做其他操作.这个功能不复杂,分为两个步骤:第一步调用远程的Rest服务逻辑包装给处理方法返回处理结果:第二步拿 ...

  6. 页面跳转到顶部---bug修改

    今天遇到一个很诡异的bug 某元素的html结构是: <div id="aa"> <span>诡异的bug</span> </div> ...

  7. http://www.ybtsoft.com/

    http://www.ybtsoft.com/ 可视化作流建模 http://www.ybtsoft.com/t3/bpm/ 慧都控件网 写一本关于互联网商业变现的书

  8. Shiro note

    我们需要实现Realms的Authentication 和 Authorization.其中 Authentication 是用来验证用户身份,Authorization 是授权访问控制,用于对用户进 ...

  9. arcgis安装路径的获得

    //Get the ArcGIS install location string sInstall = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path; / ...

  10. HUNT:一款可提升漏洞扫描能力的BurpSuite漏洞扫描插件

    今天给大家介绍的是一款BurpSuite插件,这款插件名叫HUNT.它不仅可以识别指定漏洞类型的常见攻击参数,而且还可以在BurpSuite中组织测试方法. HUNT Scanner(hunt_sca ...