結果
問題 |
No.564 背の順
|
ユーザー |
![]() |
提出日時 | 2019-03-04 22:22:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 508 bytes |
コンパイル時間 | 670 ms |
コンパイル使用メモリ | 66,368 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 14:02:00 |
合計ジャッジ時間 | 1,249 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 3 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; string f(int n){ string s = to_string(n); if(s == "1") s += "st"; else if(s == "2") s += "nd"; else if(s == "3") s += "rd"; else s += "th"; return s; } int main(void){ int h, n; cin >> h >> n; vector<int>v(n); for(int i = 0; i < n - 1; i++) cin >> v[i]; v[n - 1] = h; sort(v.begin(), v.end(), greater<int>()); for(int i = 0; i < n; i++){ if(v[i] == h) cout << f(i + 1) << endl; } return 0; }