結果

問題 No.851 テストケース
ユーザー funakoshifunakoshi
提出日時 2019-09-03 09:54:05
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 3,153 ms
コード長 1,635 bytes
コンパイル時間 859 ms
コンパイル使用メモリ 30,148 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-24 23:35:23
合計ジャッジ時間 1,560 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 0 ms
4,376 KB
testcase_11 AC 0 ms
4,380 KB
testcase_12 AC 0 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 0 ms
4,384 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 0 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 0 ms
4,380 KB
testcase_21 AC 0 ms
4,380 KB
testcase_22 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
int main(void)
{
    char str[1000]="";
    int num;
    scanf("%d\n",&num);
    long long int numlist[3]={0};
    long long int ans[3]={0};
    for(int i=0;i<num;i++)
    {
        fgets(str,100,stdin);
        for(int j=0;j<strlen(str);j++)
        {
            if(str[j]==' ')
            {
                printf("\"assert\"");
                return 0;
            }
            else
            {
                numlist[i]=atoll(str);
            }
        }
        
    }
    for(int i=0,k=0;i<num-1;i++)
    {
        if(numlist[i]<0)
        {
            numlist[i]*=-1;
        }
        for(int j=i+1;j<num;j++,k++)
        {
            if(numlist[j]<0)
            {
                numlist[j]*=-1;
            }
            ans[k]=numlist[i]+numlist[j];
        }
    }
    for(int i=0;i<num-1;i++)
    {
        for(int j=i+1;j<num;j++)
        {
            if(ans[i]>ans[j])
            {
                int tmp=ans[i];
                ans[i]=ans[j];
                ans[j]=tmp;
            }
        }
    }
    long long int show=0;
    for(int i=0;i<2;i++)
    {
        for(int j=i+1;j<3;j++)
        {
            if(ans[i]!=ans[j])
            {
                show=ans[1];
            }
            else if(ans[i]==ans[j])
            {
                if(i==0)
                {
                    show=ans[1];
                }
                else
                {
                    show=ans[0];
                }
                
            }
            
        }
    }
    printf("%lld",show);
}
0