結果
| 問題 |
No.564 背の順
|
| コンテスト | |
| ユーザー |
Haijinn
|
| 提出日時 | 2018-02-02 18:11:22 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 631 bytes |
| コンパイル時間 | 323 ms |
| コンパイル使用メモリ | 21,504 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-31 06:15:25 |
| 合計ジャッジ時間 | 921 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 4 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d%d",&h,&n);
| ^~~~~~~~~~~~~~~~~~~
main.c:15:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | scanf("%d",&h2[i]);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#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(strchr(s,'3')){
printf("%srd\n",s);
}else if(strchr(s,'2')){
printf("%snd\n",s);
}else if(strchr(s,'1')){
printf("%sst\n",s);
}else{
printf("%sth\n",s);
}
return 0;
}
Haijinn