結果

問題 No.564 背の順
ユーザー sk3388607083sk3388607083
提出日時 2018-06-24 13:58:03
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 590 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 25,992 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-13 13:38:30
合計ジャッジ時間 858 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>

void sort(int *a, int size){
  int i, j, tmp;
  for(i = 0 ; i < size-1; i++){
    for(j = size-1; j > i; j--){
      if(a[j-1] < a[j]){
	tmp = a[j-1];
	a[j-1] = a[j];
	a[j] = tmp;
      }
    }
  }
}

int main(void){
  int i;
  int N, h;
  int H[101];
  scanf("%d %d", &H[0], &N);
  h = H[0];
  for(i = 1; i < N; i++){
    scanf("%d", &H[i]);
  }
  sort(H, N);
  for(i = 1; i < N; i++){
    if(H[i] == h) break;
  }
  printf("%d", i+1);
  if(i == 0) printf("st\n");
  else if(i == 1) printf("nd\n");
  else if(i == 2) printf("rd\n");
  else printf("th\n");
  return 0;
}
0