結果
問題 |
No.564 背の順
|
ユーザー |
![]() |
提出日時 | 2018-02-02 18:04:19 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 550 bytes |
コンパイル時間 | 543 ms |
コンパイル使用メモリ | 21,120 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 20:24:38 |
合計ジャッジ時間 | 1,245 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 3 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d%d",&h,&n); | ^~~~~~~~~~~~~~~~~~~ main.c:14:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d",&h2[i]); | ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void) { int h,n; int h2[102]; int c=1; int i; int temp; int j; 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++; } } if(c==3){ printf("%drd\n",c); }else if(c==2){ printf("%dnd\n",c); }else if(c==1){ printf("%dst\n",c); }else{ printf("%dth\n",c); } return 0; }