結果

問題 No.564 背の順
ユーザー slimslim
提出日時 2018-01-27 17:04:17
言語 C
(gcc 12.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 593 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 28,972 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-28 09:58:18
合計ジャッジ時間 840 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>

int main()
{
  int h[100],n;
  int i,j,nama,temp;
  scanf("%d%d",&h[0],&n);
  nama = h[0];
  for(i = 1;i < n;i++){
    scanf("%d",&h[i]);
  }

  for(i = 0;i < n;i++){
    for(j = 0;j < n - i;j++){
      if(h[j] < h[j+1]){
        temp = h[j];
        h[j] = h[j+1];
        h[j+1] = temp;
      }
    }
  }
  i = 1;
  for(;h[i-1] != nama;i++);
  printf("%d",i);
  switch(i%10){
    case 1:
      printf("st\n");
      break;
    case 2:
      printf("nd\n");
      break;
    case 3:
      printf("rd\n");
      break;
    default:
      printf("th\n");
  }
  return(0);
}
0