zoukankan      html  css  js  c++  java
  • 测试

    int main()
    {
    int k;
    scanf("%d",&k);
    while(k--)
    {
    int n;
    scanf("%d",&n);
    int a=-1,b=-1,c=-1,flag=1;
    // int a[n];
    //vector ve;
    for(int i=0;i < n;i++)
    {
    int tmp; scanf("%d",&tmp);
    //ve[a[i]]++;
    if(a-1)
    {
    a=tmp;
    }
    else if(b
    -1&&tmp!=a)
    {
    b=tmp;
    }
    else if(c-1&&tmp!=a&&tmp!=b)
    {
    c=tmp;
    }
    else if(tmp!=a&&tmp!=b&&tmp!=c)
    {
    flag=0;
    }
    }
    if(flag
    0&&c!=-1)
    {
    printf("NO ");
    }
    else
    {
    if(c-1&&b-1)
    {
    printf("YES ");
    }
    else if(b!=-1&&c==-1)
    {
    double f=1;
    if(a > b)
    {
    f = (double)a/(double)b;
    }
    else
    {
    f = (double)b/(double)a;
    }
    if (f == int(f))
    printf("YES");
    else
    printf("NO ");
    }
    else{
    int max=a > b?a:b;
    max=max > c?max:c;
    int min=a < b?a:b;
    min=min < c?min:c;
    double d = max/min;
    if (d == int(d))
    {
    double e = sqrt(d);
    if (e == int(e))
    printf("YES ");
    else printf("NO ");
    }
    else
    printf("NO ");
    }
    }
    }
    return 0;
    }

  • 相关阅读:
    PHP中的NULL类型
    js中自定义事件,使用了jQuery
    chrome调试文章
    codeforces 633D
    hdu 1496 Equations
    poj 1286 Necklace of Beads
    poj 2154 Color
    poj 3270 Cow Sorting
    poj 1026 Cipher
    poj 2369 Permutations
  • 原文地址:https://www.cnblogs.com/sappriest/p/15331189.html
Copyright © 2011-2022 走看看