結果
問題 |
No.564 背の順
|
ユーザー |
![]() |
提出日時 | 2018-11-22 00:59:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 1,347 bytes |
コンパイル時間 | 1,151 ms |
コンパイル使用メモリ | 123,720 KB |
最終ジャッジ日時 | 2025-01-06 17:08:43 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
#include <algorithm> #include <array> #include <bitset> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <queue> using namespace std; struct BoolName : numpunct<char> { string t, f; BoolName (string t = "Yes", string f = "No") : t(t), f(f) {} string do_truename() const {return t;} string do_falsename() const {return f;} }; struct Initializer { Initializer() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(15) << boolalpha; cout.imbue(locale(cout.getloc(), new BoolName)); } } initializer; template<typename T> istream& operator>>(istream &s, vector<T> &v) { for (T &t : v) s >> t; return s; } template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) { for (const T &t : v) s << t << endl; return s; } void set_bool_name(string t, string f) { cout.imbue(locale(cout.getloc(), new BoolName(t, f))); } int main() { int h, n, r = 1; cin >> h >> n; vector<int> v(n - 1); cin >> v; for (int i : v) { if (i > h) ++r; } cout << r; if (r % 10 == 1) cout << "st" << endl; else if (r % 10 == 2) cout << "nd" << endl; else if (r % 10 == 3) cout << "rd" << endl; else cout << "th" << endl; }