結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 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,num,stdin);
        if(str[1]==' ')
        {
            printf("\"assert\"");
            return 0;
        }
        else
        {
            numlist[i]=str[0]-'0';
        }
        
    }
    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