結果

問題 No.564 背の順
ユーザー yutakahanyutakahan
提出日時 2017-09-12 03:48:28
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 1,272 bytes
コンパイル時間 811 ms
コンパイル使用メモリ 103,296 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-04-25 06:01:57
合計ジャッジ時間 1,684 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

using System;
public class Hello{
     
    public static void Main(){
        string[] input = Console.ReadLine().Split(' ');
        int nama = int.Parse(input[0]);
        int N = int.Parse(input[1]);
        
        int[] height = new int[N];
        for(int x = 0;x < N - 1;x++){
            int input2 = int.Parse(Console.ReadLine());
            height[x] = input2;
        }
        height[N - 1] = nama;
        
        
        for(int y = 0;y < N - 1;y++){
            for(int z = y + 1;z < N;z++){
                if(height[y] < height[z]){
                    int temp;
                    temp = height[y];
                    height[y] = height[z];
                    height[z] = temp;
                }
            }
        }
        
        for(int i = 0;i < N;i++){
            if(nama == height[i]){
                if((i + 1) % 10 == 1){
                    Console.WriteLine((i + 1) + "st");
                }else if((i + 1) % 10 == 2){
                    Console.WriteLine((i + 1) + "nd");
                }else if((i + 1) % 10 == 3){
                    Console.WriteLine((i + 1) + "rd");
                }else{
                    Console.WriteLine((i + 1) + "th");
                }
                
            }
        }
        
    }
}
0