結果
問題 | No.564 背の順 |
ユーザー | Haijinn |
提出日時 | 2018-02-02 18:15:03 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 942 ms |
コンパイル使用メモリ | 25,088 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-08-30 01:35:50 |
合計ジャッジ時間 | 934 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 0 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 0 ms
4,380 KB |
testcase_09 | AC | 1 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,376 KB |
testcase_11 | AC | 0 ms
4,384 KB |
ソースコード
#include <stdio.h> #include <string.h> int main(void) { int h,n; int h2[102]; int c=1; int i; int temp; int j; char s[1000]; scanf("%d%d",&h,&n); for(i=0;i<n-1;i++){ scanf("%d",&h2[i]); } for(i=0;i<n-1;i++){ for(j=n-2;j>i;j--){ if(h2[j]>h2[j-1]){ temp=h2[j]; h2[j]=h2[j-1]; h2[j-1]=temp; } } } for(i=0;i<n-1;i++){ if(h2[i]>h){ c++; } } sprintf(s,"%d",c); if(s[strlen(s)-1]=='3'){ printf("%srd\n",s); }else if(s[strlen(s)-1]=='2'){ printf("%snd\n",s); }else if(s[strlen(s)-1]=='1'){ printf("%sst\n",s); }else{ printf("%sth\n",s); } return 0; }