結果

問題 No.564 背の順
ユーザー dragonlaunch
提出日時 2017-11-12 03:10:39
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-24 20:03:53
合計ジャッジ時間 1,089 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

H,N = [int(i) for i in input().split()]
h = []
for i in range(N-1):
    h.append(int(input()))
h.sort()
#print(h)
high = len(h)
low = 0
while(high > low):
    mid = (low + high)//2
    if h[mid] >= H:
        high = mid
    if h[mid] < H:
        low = mid + 1
if (N-low) % 10 == 1:
    print(str(N-low)+'st')
elif (N - low) % 10 == 2:
    print(str(N - low) + 'nd')
elif (N - low) % 10 == 3:
    print(str(N - low) + 'rd')
else:
    print(str(N-low)+'th')
0