結果
| 問題 |
No.564 背の順
|
| コンテスト | |
| ユーザー |
cww
|
| 提出日時 | 2017-09-08 23:11:38 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 745 bytes |
| コンパイル時間 | 1,868 ms |
| コンパイル使用メモリ | 172,232 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 12:13:18 |
| 合計ジャッジ時間 | 2,595 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
int H, N;
cin >> H >> N;
vector<int> vc;
vc.emplace_back( H );
int height;
REP( i, N - 1 )
{
cin >> height;
vc.emplace_back( height );
}
sort( ALL( vc ) );
REP( i, N )
{
if( vc[ i ] == H )
{
string S = to_string( N - i );
cout << S;
cout << ( S[ S.size() - 1 ] == '1' ? "st" : S[ S.size() - 1 ] == '2' ? "nd" : S[ S.size() - 1 ] == '3' ? "rd" : "th" ) << endl;
}
}
return 0;
}
cww