Submission #2377

# Submission time Handle Problem Language Result Execution time Memory
2377 2013-07-21T04:31:31 Z hgp744 개미 (GA4_ant) C++
100 / 100
62 ms 1376 KB
#include <iostream>
#include <stdio.h>

using namespace std;


int main()

{

    long long n,a[8],k,i,j;

    scanf("%lld",&n);

    for(k=1;k<=n;k++)

    {

        scanf("%lld%lld%lld",&a[1],&a[2],&a[3]);

        if(!a[1]) printf("%lld\n",a[2]*a[2]+a[3]*a[3]);

        else

        {

            for(i=1;i<=2;i++) for(j=i+1;j<=3;j++) if(a[i]>a[j])

            {

                a[i]=a[i]+a[j];a[j]=a[i]-a[j];a[i]=a[i]-a[j];

            }

            printf("%lld\n",a[1]*a[1]+a[2]*a[2]+a[3]*a[3]+2*a[1]*a[2]);

        }

    }

    return 0;

}
# Verdict Execution time Memory Grader output
1 Correct 40 ms 1376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 1376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 1376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 1376 KB Output is correct
2 Correct 51 ms 1376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 1376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 1376 KB Output is correct
2 Correct 55 ms 1376 KB Output is correct
3 Correct 58 ms 1376 KB Output is correct
4 Correct 53 ms 1376 KB Output is correct
5 Correct 59 ms 1376 KB Output is correct