結果
問題 |
No.564 背の順
|
ユーザー |
![]() |
提出日時 | 2017-09-12 03:48:28 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 23 ms / 2,000 ms |
コード長 | 1,272 bytes |
コンパイル時間 | 957 ms |
コンパイル使用メモリ | 112,520 KB |
実行使用メモリ | 18,048 KB |
最終ジャッジ日時 | 2024-11-07 16:09:01 |
合計ジャッジ時間 | 1,570 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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"); } } } } }