結果

問題 No.564 背の順
ユーザー バカらっくバカらっく
提出日時 2017-09-08 22:26:14
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 1,414 bytes
コンパイル時間 3,435 ms
コンパイル使用メモリ 108,672 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2024-04-25 02:30:35
合計ジャッジ時間 2,077 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
19,072 KB
testcase_01 AC 32 ms
19,200 KB
testcase_02 AC 33 ms
19,072 KB
testcase_03 AC 31 ms
19,072 KB
testcase_04 AC 30 ms
19,200 KB
testcase_05 AC 33 ms
19,200 KB
testcase_06 AC 33 ms
19,200 KB
testcase_07 AC 34 ms
19,328 KB
testcase_08 AC 34 ms
19,200 KB
testcase_09 AC 35 ms
19,200 KB
testcase_10 AC 32 ms
19,328 KB
testcase_11 AC 32 ms
19,200 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

	public void Proc()
	{
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int target = inpt[0];
        int cnt = inpt[1];

        List<int> list = new List<int>();
        for (int i = 0; i < cnt-1; i++) {
            list.Add(int.Parse(Reader.ReadLine()));
        }
        list.Add(target);
        list = list.OrderByDescending(a => a).ToList();
        int ans = list.IndexOf(target) + 1;

        string ansStr;
        if(ans%10==1) {
            ansStr = ans + "st";
        }else if(ans%10==2) {
            ansStr = ans + "nd";
        } else if(ans%10==3) {
            ansStr = ans + "rd";
        } else {
            ansStr = ans + "th";
        }
        Console.WriteLine(ansStr);
    
    
    }



    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"



157 4
160
175
168

";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}
0