結果
| 問題 |
No.564 背の順
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-22 20:31:32 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 925 bytes |
| コンパイル時間 | 1,157 ms |
| コンパイル使用メモリ | 113,644 KB |
| 実行使用メモリ | 27,232 KB |
| 最終ジャッジ日時 | 2024-09-16 04:18:17 |
| 合計ジャッジ時間 | 2,090 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 3 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main(string[] args)
{
var line = Console.ReadLine().Split(' ');
var height = int.Parse(line[0]);
var N = int.Parse(line[1]);
var list = new List<int>(N) { height };
for (int i = 0; i < N-1; i++)
list.Add(int.Parse(Console.ReadLine()));
list = list.OrderByDescending(x => x).Distinct().ToList();
int idx = list.IndexOf(height) + 1;
switch (idx)
{
case 1:
Console.WriteLine("{0}st", idx);
break;
case 2:
Console.WriteLine("{0}nd", idx);
break;
case 3:
Console.WriteLine("{0}rd", idx);
break;
default:
Console.WriteLine("{0}th", idx);
break;
}
}
}