bnu10805矩形神码的

    xiaoxiao2024-04-21  6

    矩形神码的

    Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO format:  %lld      Java class name:  Main Special Judge Prev  Submit  Status  Statistics  Discuss   Next
    Type:  None   None Graph Theory      2-SAT     Articulation/Bridge/Biconnected Component      Cycles/Topological Sorting/Strongly Connected Component      Shortest Path          Bellman Ford         Dijkstra/Floyd Warshall      Euler Trail/Circuit      Heavy-Light Decomposition     Minimum Spanning Tree      Stable Marriage Problem      Trees     Directed Minimum Spanning Tree      Flow/Matching          Graph Matching             Bipartite Matching              Hopcroft–Karp Bipartite Matching              Weighted Bipartite Matching/Hungarian Algorithm          Flow              Max Flow/Min Cut             Min Cost Max Flow  DFS-like      Backtracking with Pruning/Branch and Bound      Basic Recursion     IDA* Search      Parsing/Grammar     Breadth First Search/Depth First Search      Advanced Search Techniques          Binary Search/Bisection         Ternary Search  Geometry      Basic Geometry     Computational Geometry      Convex Hull      Pick's Theorem Game Theory      Green Hackenbush/Colon Principle/Fusion Principle      Nim     Sprague-Grundy Number  Matrix     Gaussian Elimination      Matrix Exponentiation Data Structures      Basic Data Structures     Binary Indexed Tree      Binary Search Tree      Hashing     Orthogonal Range Search      Range Minimum Query/Lowest Common Ancestor      Segment Tree/Interval Tree     Trie Tree      Sorting      Disjoint Set String      Aho Corasick     Knuth-Morris-Pratt      Suffix Array/Suffix Tree Math      Basic Math     Big Integer Arithmetic      Number Theory         Chinese Remainder Theorem          Extended Euclid          Inclusion/Exclusion         Modular Arithmetic      Combinatorics          Group Theory/Burnside's lemma         Counting      Probability/Expected Value  Others     Tricky      Hardest     Unusual      Brute Force     Implementation      Constructive Algorithms     Two Pointer      Bitmask     Beginner      Discrete Logarithm/Shank's Baby-step Giant-step Algorithm      Greedy     Divide and Conquer  Dynamic Programming                   Tag it!
    我们都知道,矩形是由两条对角线的,没错吧?(谜之声:这不是显然么!)这两条线的长度也是相等的,没错吧?(谜之声:这不废话么!)然后我们给定一条对角线的起始点和终止点的坐标,然后给定另一个对角线和他的夹角,是不是就能得到两个面积相等的矩形?(谜之声:呃,貌似好像或许应该可能maybe perhaps probably possibly是对的?) 现在我需要你求出这个矩形的面积。

    Input

    第一行,一个整数T(0<T<=10000),表示数据组数。 接下来T行,每行5个浮点数。分别是x1,y1,x2,y2,theta。表示一条对角线的起始点和终止点的坐标,以及另一条对角线与他的夹角。坐标的绝对值范围均在10 4以内,夹角范围(0,90]。

    Output

    对于每一组数据,输出一行,表示面积,精确到小数点后六位。 绝对误差或者相对误差在0.0001内均算通过。

    Sample Input

    2 1.0 1.0 -1.0 -1.0 90.0 3.0 2.0 2.5 9.99 36.00

    Sample Output

    4.000000 18.835608

    Hint

    pi请取值acos(-1.0)或者3.1415926535898

    #include <iostream> #include <cstring> #include <cstdio> #include <cmath> #define pi 3.1415926535898 using namespace std; int main() { double x1,y1,x2,y2; double t; int n; scanf("%d",&n); while(n--) { scanf("%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&t); double d=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/2; double a=t/180*pi; double b=pi-a; double s=d*d*sin(a)+d*d*sin(b);//三角形面积公式1/2bcsina printf("%.6lf\n",s); } return 0; }

    转载请注明原文地址: https://ju.6miu.com/read-1288225.html
    最新回复(0)