/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Wrong Answer 25ms 540.0 KiB
#3 Wrong Answer 27ms 400.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;

bool sq(int hysq)
{
    if(ceil(sqrt(hysq))==floor(sqrt(hysq))){
        return true;
    }
    else{return false;}
}

void sir()
{
    int b;
    cin>>b;
    int hi, hysq;
    int para = 0;
    for(hi=1; hi<= b*b/2; hi++)
    {
        hysq = hi*hi + b*b;

        if(sq(hysq)){
            para = max(para, (hi + b + int(sqrt(hysq))));
        }
    }
    if(para != 0)
    {
        cout<<para<<endl;
    }
    else{cout<<-1<<endl;}

}


int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        sir();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1027 Right triangle
Language
C++20 (G++ 13.2.0)
Submit At
2024-03-12 09:17:10
Judged At
2024-11-11 03:41:01
Judged By
Score
5
Total Time
27ms
Peak Memory
540.0 KiB