zoukankan      html  css  js  c++  java
  • 【三角形数量】

    cathetus(直角边); hypotenuse(斜边)

    spoj:Structures

         给定三角形的直角边,问可以有多少种三角形。 T<=10 , N<=1e15 ,times<=1s.

    spoj:Shared cathetus (easy)

         给定三角形的直角边,问可以有多少种三角形。T<=1e5,N<=1e9,times<=1.899s.

    spoj:Pythagorean Triple Counting1

        给定三角形的直角边,问可以有多少种三角形。T<=1e3,N<=1e15,times<=30s.

    spoj:Pythagorean Triple Counting2

    给定三角形的直角边,问可以有多少种三角形。T<=1e3,N<=1e15,times<=1s.

     

    spoj:Pythagorean triples (medium)

    给出N;(N<1.2e8),问有多少个三角形的斜边小于等于N。tiems:1s-15s

    spoj:Counting Pythagorean Triples

    给出N;(N<1.2e12),问有多少个三角形的斜边小于等于N。tiems:1s-15s

    ZOJ1574:Pythagorean Triples

     求第N个prim直角三角形(即a和b互素)。按a,b的优先度关键字排序。N<1e5。

     

    EIJ127:Pythagorean triples

     求第N直角三角形,按c,a,b的优先关键字排序。N<1e6。

     

    CIRCIRC - Missing Side

     给出三角形两边,求第三边。使得这个三角形的外接三角形面积减内接三角形面积最小。

    codeforces 707 C: Pythagorean Triples

    给定三角形一条边(直角边或斜边),输出其他两条边。T=1,N<=1e9;

              当a>1,为奇数, 令x=(a-1)/2; b=2*x*(x+1),c=2*x*(x+1)+1; 
              当a>2,为偶数,令x=a/2;  b=x*x-1,c=x*x+1; 
    #include<bits/stdc++.h>
    #define ll long long
    using namespace std;
    int main()
    {
        ll N,x,b,c;
        scanf("%lld",&N);
        if(N==1||N==2) printf("-1
    ");
        else {
            x=N/2;
            if(N&1LL) b=2*x*(x+1),c=b+1;
            else b=x*x-1,c=b+2;
            printf("%lld %lld
    ",b,c); 
        }
        return 0;
    }
    View Code

    There are 16 primitive Pythagorean triples with c ≤ 100:

    (3, 4, 5) (5, 12, 13) (8, 15, 17) (7, 24, 25)
    (20, 21, 29) (12, 35, 37) (9, 40, 41) (28, 45, 53)
    (11, 60, 61) (16, 63, 65) (33, 56, 65) (48, 55, 73)
    (13, 84, 85) (36, 77, 85) (39, 80, 89) (65, 72, 97)

    Note, for example, that (6, 8, 10) is not a primitive Pythagorean triple, as it is a multiple of (3, 4, 5). Each of these low-c points forms one of the more easily recognizable radiating lines in the scatter plot.

    Additionally these are all the primitive Pythagorean triples with 100 < c ≤ 300:

    (20, 99, 101) (60, 91, 109) (15, 112, 113) (44, 117, 125)
    (88, 105, 137) (17, 144, 145) (24, 143, 145) (51, 140, 149)
    (85, 132, 157) (119, 120, 169) (52, 165, 173) (19, 180, 181)
    (57, 176, 185) (104, 153, 185) (95, 168, 193) (28, 195, 197)
    (84, 187, 205) (133, 156, 205) (21, 220, 221) (140, 171, 221)
    (60, 221, 229) (105, 208, 233) (120, 209, 241) (32, 255, 257)
    (23, 264, 265) (96, 247, 265) (69, 260, 269) (115, 252, 277)
    (160, 231, 281) (161, 240, 289) (68, 285, 293)

    【参考】维基百科:https://en.wikipedia.org/wiki/Pythagorean_triple

  • 相关阅读:
    对js数组的splice实现
    前端必读
    命令模式
    访问者模式
    观察者模式
    解释器模式
    装饰器模式
    组合模式
    抽象工厂模式
    搜索结果关键词高亮显示
  • 原文地址:https://www.cnblogs.com/hua-dong/p/9074680.html
Copyright © 2011-2022 走看看