結果
| 問題 |
No.564 背の順
|
| ユーザー |
Risen
|
| 提出日時 | 2017-09-08 22:25:39 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 911 bytes |
| コンパイル時間 | 2,619 ms |
| コンパイル使用メモリ | 109,184 KB |
| 実行使用メモリ | 19,584 KB |
| 最終ジャッジ日時 | 2024-11-07 05:23:19 |
| 合計ジャッジ時間 | 3,404 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 Solution
{
static void Main()
{
var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
int h = vals[0];
int n = vals[1];
var hs = new int[n];
hs[0] = h;
for (int i = 1; i < n; i++)
{
hs[i] = int.Parse(Console.ReadLine());
}
var index = hs.OrderByDescending(i => i).ToList().FindIndex(i => i == h) + 1;
var result = index.ToString();
switch (index)
{
case 1:
result += "st";
break;
case 2:
result += "nd";
break;
case 3:
result += "rd";
break;
default:
result += "th";
break;
}
Console.WriteLine(result);
}
}
Risen