結果
問題 | No.564 背の順 |
ユーザー | sk3388607083 |
提出日時 | 2018-06-24 13:59:26 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 590 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 26,124 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-13 13:38:20 |
合計ジャッジ時間 | 933 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,384 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | WA | - |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,376 KB |
testcase_06 | AC | 2 ms
4,376 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 1 ms
4,380 KB |
testcase_10 | AC | 2 ms
4,376 KB |
testcase_11 | AC | 2 ms
4,376 KB |
ソースコード
#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 = 0; 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; }