結果

問題 No.851 テストケース
ユーザー funakoshifunakoshi
提出日時 2019-09-03 09:49:02
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,440 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 29,876 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-24 23:28:01
合計ジャッジ時間 1,369 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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);
    int numlist[3]={0};
    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]=atoi(str);
            }
        }
        
    }
    for(int i=0,k=0;i<num-1;i++)
    {
        for(int j=i+1;j<num;j++,k++)
        {
            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;
            }
        }
    }
    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("%d",show);
}
0