Ural 1258 镜面对称
- #include<cstdio>
- #include<cstring>
- #include<cmath>
- #include<iostream>
- #include<algorithm>
- #include<queue>
- using namespace std;
- const double eps = 1e-;
- const double PI = acos(-1.0);
- const double INF = 1000000000000000.000;
- struct Point{
- double x,y;
- Point(double x=, double y=) : x(x),y(y){ } //构造函数
- };
- typedef Point Vector;
- Vector operator + (Vector A , Vector B){return Vector(A.x+B.x,A.y+B.y);}
- Vector operator - (Vector A , Vector B){return Vector(A.x-B.x,A.y-B.y);}
- Vector operator * (double p,Vector A){return Vector(A.x*p,A.y*p);}
- Vector operator / (Vector A , double p){return Vector(A.x/p,A.y/p);}
- bool operator < (const Point& a,const Point& b){
- return a.x < b.x ||( a.x == b.x && a.y < b.y);
- }
- int dcmp(double x){
- if(fabs(x) < eps) return ;
- else return x < ? - : ;
- }
- bool operator == (const Point& a, const Point& b){
- return dcmp(a.x - b.x) == && dcmp(a.y - b.y) == ;
- }
- ///向量(x,y)的极角用atan2(y,x);
- inline double Dot(Vector A, Vector B){ return A.x*B.x + A.y*B.y; }
- inline double Length(Vector A) { return sqrt(Dot(A,A)); }
- inline double Angle(Vector A, Vector B) { return acos(Dot(A,B) / Length(A) / Length(B)); }
- double Cross(Vector A, Vector B) { return A.x*B.y - A.y * B.x; }
- Point read_point(){
- Point A;
- scanf("%lf %lf",&A.x,&A.y);
- return A;
- }
- /*************************************分 割 线*****************************************/
- int main()
- {
- //freopen("E:\\acm\\input.txt","r",stdin);
- double W,D;
- Point S,T;
- char s[];
- scanf("%lf %lf",&W,&D);
- double x,y;
- scanf("%lf %lf",&x,&y);
- S = Point(-x,y);
- scanf("%lf %lf",&x,&y);
- T = Point(-x,y);
- scanf("%s",s);
- int len = strlen(s);
- for(int i=;i<len;i++){
- if(s[i] == 'F'){
- S.y = -S.y;
- }
- else if(s[i] == 'L'){
- S.x = -S.x;
- }
- else if(s[i] == 'B'){
- S.y = *D -S.y;
- }
- if(s[i] == 'R'){
- S.x = -*W-S.x;
- }
- //cout<<S.x<<" "<<S.y<<endl;
- }
- double ans = Length(S-T);
- printf("%.4lf\n",ans);
- }
Ural 1258 镜面对称的更多相关文章
- hdu 1258 Sum It Up(dfs+去重)
题目大意: 给你一个总和(total)和一列(list)整数,共n个整数,要求用这些整数相加,使相加的结果等于total,找出所有不相同的拼凑方法. 例如,total = 4,n = 6,list = ...
- POJ 1258
http://poj.org/problem?id=1258 今天晚上随便找了两道题,没想到两道都是我第一次碰到的类型———最小生成树.我以前并没有见过,也不知道怎么做,然后就看书,思路很容易理解 但 ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2073. Log Files
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...
- ural 2070. Interesting Numbers
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...
- ural 2069. Hard Rock
2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...
- ural 2068. Game of Nuts
2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...
- ural 2067. Friends and Berries
2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. ...
随机推荐
- pat_1008
1008. 数组元素循环右移问题 (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 8000 B 判题程序 Standard 一个数组A中存有N(N>0)个整数,在不允 ...
- JavaWeb学习----JSP简介及入门(JSP结构及JSP处理)
[声明] 欢迎转载,但请保留文章原始出处→_→ 艾水及水:http://www.cnblogs.com/liuhepeng 文章来源:http://www.cnblogs.com/liuhepeng ...
- 简单的完全背包HDU1114
今天广州下雨啦,不过没关系啦,反正我最近也都在刷题学习算法. 昨天做了五题01背包,今天还是背包,不过是完全背包,估计做动态规划要持续好一段时间,一开始选了一道简单题目啦. HDU1114,看了小一段 ...
- wamp不能使用phpmyadmin,提示“You don't have permission to access /phpmyadmin/ on this server.” 转载
换了win8之后wamp明显不怎么好用了,显示80端口被system占用,后是masql出现了403错误,多番百度谷歌找到了解决方案,这里与大家分享 当你安装完成wamp后,打开localhost或i ...
- Python之练习Demo
遍历本地文件系统 (sys, os, path),例如写一个程序统计一个目录下所有文件大小并按各种条件排序并保存结果,代码如下: #coding:GBK import os; def SortList ...
- 怎样让老浏览器兼容html5新标签
CSS样式设置默认样式: <style> article, aside, canvas, details, figcaption, figure, footer, header, hgro ...
- hibernate映射
三种方式: 持久化注解 目前开发主流方式 XML配置描述文件(XML deployment descriptor,可以让Hibernate的PO类与JPA实体类兼容,实际中很少用) ...
- CI源码引用使用--php引用demo,静态变量和引用关系
CI源码引用使用在Common.php中,加载配置和类的方法 function &test() { static $a = ''; if (!$a) { $a ...
- shell编程的一些例子1
1.$0-$9及$# $@的使用 demo_arg 内容 #!/bin/bash echo "程序名:$0" echo "命令传递参数个数:$#" echo & ...
- ruby 中文支持设置
学习Ruby的过程中,对于于涉及中文的的代码的时候,需要添加如下代码在首行 # encoding: utf-8 或者EMAC写法 # -*- coding : utf-8 -*- 因为Ruby编译器会 ...