Submission #2320

# Submission time Handle Problem Language Result Execution time Memory
2320 2013-07-21T02:35:27 Z crazysoldier 개미 (GA4_ant) C++
100 / 100
63 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 39 ms 1376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 1376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 1376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 1376 KB Output is correct
2 Correct 52 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 53 ms 1376 KB Output is correct
2 Correct 59 ms 1376 KB Output is correct
3 Correct 60 ms 1376 KB Output is correct
4 Correct 63 ms 1376 KB Output is correct
5 Correct 63 ms 1376 KB Output is correct