結果
問題 | No.564 背の順 |
ユーザー |
![]() |
提出日時 | 2018-03-11 16:17:00 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 800 bytes |
コンパイル時間 | 110 ms |
コンパイル使用メモリ | 29,952 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-15 00:18:54 |
合計ジャッジ時間 | 707 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 3 |
ソースコード
#include <stdio.h>int main(void){int hx, h[100], n, t, i, k;scanf("%d%d", &hx, &n);for(i = 0; i < n-1; i++){scanf("%d", &h[i]);}do{k = 0;for(i = 0; i < n-2; i++){if(h[i] < h[i+1]){t = h[i];h[i] = h[i+1];h[i+1] = t;k++;}}}while(k != 0);k = 1;for(i = 0; i < n-1; i++){if(h[i] > hx){k++;}else{break;}}if(k == 1){printf("%dst\n", k);}else if(k == 2){printf("%dnd\n", k);}else if(k == 3){printf("%drd\n", k);}else{printf("%dth\n", k);}return 0;}