結果
| 問題 | No.564 背の順 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-10-11 23:54:12 | 
| 言語 | C90 (gcc 12.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 439 bytes | 
| コンパイル時間 | 127 ms | 
| コンパイル使用メモリ | 20,864 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-17 09:54:28 | 
| 合計ジャッジ時間 | 722 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |   scanf ("%d %d", &H, &N );
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d", &h[i]);
      |     ^~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
int main() {
  int H, h[100] = {0}, N, i, count = 1;
  scanf ("%d %d", &H, &N );
  for (i = 0; i < N-1; i++) {
    scanf("%d", &h[i]);
    if (H < h[i]) {
      count++;
    }
  }
  if (count%100%10 == 1) {
    printf("%dst\n", count);
  } else if (count%100%10 == 2) {
    printf("%dnd\n", count);
  } else if (count%100%10 == 3) {
    printf("%drd\n", count);
  } else {
    printf("%dth\n", count);
  }
  return 0;
}
            
            
            
        