1. #include<cstdio>
  2. #include<cstring>
  3. #include<cmath>
  4. #include<iostream>
  5. #include<algorithm>
  6. #include<queue>
  7. using namespace std;
  8.  
  9. const double eps = 1e-;
  10. const double PI = acos(-1.0);
  11. const double INF = 1000000000000000.000;
  12.  
  13. struct Point{
  14. double x,y;
  15. Point(double x=, double y=) : x(x),y(y){ } //构造函数
  16. };
  17. typedef Point Vector;
  18.  
  19. Vector operator + (Vector A , Vector B){return Vector(A.x+B.x,A.y+B.y);}
  20. Vector operator - (Vector A , Vector B){return Vector(A.x-B.x,A.y-B.y);}
  21. Vector operator * (double p,Vector A){return Vector(A.x*p,A.y*p);}
  22. Vector operator / (Vector A , double p){return Vector(A.x/p,A.y/p);}
  23.  
  24. bool operator < (const Point& a,const Point& b){
  25. return a.x < b.x ||( a.x == b.x && a.y < b.y);
  26. }
  27.  
  28. int dcmp(double x){
  29. if(fabs(x) < eps) return ;
  30. else return x < ? - : ;
  31. }
  32. bool operator == (const Point& a, const Point& b){
  33. return dcmp(a.x - b.x) == && dcmp(a.y - b.y) == ;
  34. }
  35.  
  36. ///向量(x,y)的极角用atan2(y,x);
  37. inline double Dot(Vector A, Vector B){ return A.x*B.x + A.y*B.y; }
  38. inline double Length(Vector A) { return sqrt(Dot(A,A)); }
  39. inline double Angle(Vector A, Vector B) { return acos(Dot(A,B) / Length(A) / Length(B)); }
  40. double Cross(Vector A, Vector B) { return A.x*B.y - A.y * B.x; }
  41.  
  42. Point read_point(){
  43. Point A;
  44. scanf("%lf %lf",&A.x,&A.y);
  45. return A;
  46. }
  47.  
  48. /*************************************分 割 线*****************************************/
  49.  
  50. int main()
  51. {
  52. //freopen("E:\\acm\\input.txt","r",stdin);
  53. double W,D;
  54. Point S,T;
  55. char s[];
  56.  
  57. scanf("%lf %lf",&W,&D);
  58. double x,y;
  59. scanf("%lf %lf",&x,&y);
  60. S = Point(-x,y);
  61. scanf("%lf %lf",&x,&y);
  62. T = Point(-x,y);
  63. scanf("%s",s);
  64. int len = strlen(s);
  65.  
  66. for(int i=;i<len;i++){
  67. if(s[i] == 'F'){
  68. S.y = -S.y;
  69. }
  70. else if(s[i] == 'L'){
  71. S.x = -S.x;
  72. }
  73. else if(s[i] == 'B'){
  74. S.y = *D -S.y;
  75. }
  76. if(s[i] == 'R'){
  77. S.x = -*W-S.x;
  78. }
  79. //cout<<S.x<<" "<<S.y<<endl;
  80. }
  81. double ans = Length(S-T);
  82.  
  83. printf("%.4lf\n",ans);
  84. }

Ural 1258 镜面对称的更多相关文章

  1. hdu 1258 Sum It Up(dfs+去重)

    题目大意: 给你一个总和(total)和一列(list)整数,共n个整数,要求用这些整数相加,使相加的结果等于total,找出所有不相同的拼凑方法. 例如,total = 4,n = 6,list = ...

  2. POJ 1258

    http://poj.org/problem?id=1258 今天晚上随便找了两道题,没想到两道都是我第一次碰到的类型———最小生成树.我以前并没有见过,也不知道怎么做,然后就看书,思路很容易理解 但 ...

  3. 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome

    题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...

  4. ural 2071. Juice Cocktails

    2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...

  5. ural 2073. Log Files

    2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...

  6. ural 2070. Interesting Numbers

    2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...

  7. ural 2069. Hard Rock

    2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...

  8. 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 ...

  9. ural 2067. Friends and Berries

    2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. ...

随机推荐

  1. pat_1008

    1008. 数组元素循环右移问题 (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 8000 B 判题程序 Standard 一个数组A中存有N(N>0)个整数,在不允 ...

  2. JavaWeb学习----JSP简介及入门(JSP结构及JSP处理)

    ​[声明] 欢迎转载,但请保留文章原始出处→_→ 艾水及水:http://www.cnblogs.com/liuhepeng 文章来源:http://www.cnblogs.com/liuhepeng ...

  3. 简单的完全背包HDU1114

    今天广州下雨啦,不过没关系啦,反正我最近也都在刷题学习算法. 昨天做了五题01背包,今天还是背包,不过是完全背包,估计做动态规划要持续好一段时间,一开始选了一道简单题目啦. HDU1114,看了小一段 ...

  4. wamp不能使用phpmyadmin,提示“You don't have permission to access /phpmyadmin/ on this server.” 转载

    换了win8之后wamp明显不怎么好用了,显示80端口被system占用,后是masql出现了403错误,多番百度谷歌找到了解决方案,这里与大家分享 当你安装完成wamp后,打开localhost或i ...

  5. Python之练习Demo

    遍历本地文件系统 (sys, os, path),例如写一个程序统计一个目录下所有文件大小并按各种条件排序并保存结果,代码如下: #coding:GBK import os; def SortList ...

  6. 怎样让老浏览器兼容html5新标签

    CSS样式设置默认样式: <style> article, aside, canvas, details, figcaption, figure, footer, header, hgro ...

  7. hibernate映射

    三种方式:     持久化注解   目前开发主流方式     XML配置描述文件(XML deployment descriptor,可以让Hibernate的PO类与JPA实体类兼容,实际中很少用) ...

  8. CI源码引用使用--php引用demo,静态变量和引用关系

    CI源码引用使用在Common.php中,加载配置和类的方法 function &test() {     static $a = '';     if (!$a) {         $a ...

  9. shell编程的一些例子1

    1.$0-$9及$# $@的使用 demo_arg 内容 #!/bin/bash echo "程序名:$0" echo "命令传递参数个数:$#" echo & ...

  10. ruby 中文支持设置

    学习Ruby的过程中,对于于涉及中文的的代码的时候,需要添加如下代码在首行 # encoding: utf-8 或者EMAC写法 # -*- coding : utf-8 -*- 因为Ruby编译器会 ...