結果

問題 No.564 背の順
ユーザー jokin_tokeijokin_tokei
提出日時 2017-09-08 23:12:39
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 28,784 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-07 08:33:43
合計ジャッジ時間 1,261 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

#define THOUSAND 1000

void order() {
	int nama_height = 0, num = 0;
	int other_height[THOUSAND] = { };
	int i, j;

	int rank = 1;

	scanf("%d %d\n", &nama_height, &num);

	for (i = 0; i < num; i++) {
			scanf("%d\n", &other_height[i]);
	}

	for (j = 0; j < num - 1; j++) {
		if (nama_height < other_height[j]) {
			rank++;
		}
	}

	printf("%d", rank);

	switch (rank % 10) {
	case 1:
		printf("st\n");
		break;
	case 2:
		printf("nd\n");
		break;
	case 3:
		printf("rd\n");
		break;
	default:
		printf("th\n");
		break;
	}

}

int main(void) {

	order();

	return 0;
}
0