結果
問題 | No.564 背の順 |
ユーザー |
![]() |
提出日時 | 2018-09-27 23:48:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 940 bytes |
コンパイル時間 | 742 ms |
コンパイル使用メモリ | 79,332 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 04:39:49 |
合計ジャッジ時間 | 1,457 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
//inlclude前用define#define _USE_MATH_DEFINES//include#include<iostream>#include<string>#include<algorithm>#include<vector>#include<cmath>#include<cstdio>#include<type_traits>#include<numeric>#include<limits>#include<iomanip>using namespace std;//typedeftypedef vector<int> VI;typedef vector<string> VS;typedef vector<char> VC;//grobal変数int main() {int h, n;string s;cin >> h >> n;VI height(n-1);for (int i = 0; i < n-1; i++)cin >> height[i];int memo=-1;height.push_back(h);sort(height.begin(), height.end());reverse(height.begin(), height.end());/*for (int i = 0; i < n; i++) cout << height[i] << " ";cout << "\n";*/for (int i = 0; i < n; i++) {if (height[i] == h) {memo = i;}}memo++;if (memo % 10 == 1) {s = "st";}else if (memo % 10 == 2) {s = "nd";}else if (memo % 10 == 3) {s = "rd";}else {s = "th";}cout << memo << s << endl;return 0;}