結果

問題 No.851 テストケース
ユーザー michonz4michonz4
提出日時 2020-01-05 14:17:55
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 659 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 29,376 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-14 21:02:23
合計ジャッジ時間 1,072 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#define SWAP(type, a, b) {type tmp=a; a=b; b=tmp;}
typedef long long ll;

int main() {
  int n;
  scanf("%d%*c", &n);

  char s[100];
  ll arr[3], j=0;
  while (fgets(s, 100, stdin)!=NULL) {

    for (int i=0; s[i]!='\0'; i++) {
      if (s[i]==' ') {
        printf("assert");
        return 0;
      }
    }

    sscanf(s, "%d", &arr[j++]);
  }
   
  for (int i=0; i<n; i++) {
    for (int j=n-1; j>0; j--) {
      if (arr[j]<arr[j-1]) {
        SWAP(ll, arr[j], arr[j-1]);
      }
    }
  }

  if (arr[0]==arr[1] || arr[1]==arr[2]) {
    printf("%lld\n", arr[0]+arr[1]);
  } else {
    printf("%lld\n", arr[0]+arr[2]);
  }

  return 0;
}
0