結果
問題 |
No.564 背の順
|
ユーザー |
|
提出日時 | 2017-09-09 07:03:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 622 bytes |
コンパイル時間 | 1,570 ms |
コンパイル使用メモリ | 168,216 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 07:48:23 |
合計ジャッジ時間 | 2,176 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int H, N; cin >> H >> N; vector<int> Hs(N - 1); for (auto & h : Hs) cin >> h; int r = 1; for (int i = 0; i != Hs.size(); ++i){ if (Hs[i] > H) ++r; } if (r % 10 == 1){ cout << r << "st" << endl; // 11th でなく、11st }else if (r % 10 == 2){ cout << r << "nd" << endl; // 12th でなく、12nd }else if (r % 10 == 3){ cout << r << "rd" << endl; // 13th でなく、13rd }else{ cout << r << "th" << endl; } return 0; }