結果

問題 No.564 背の順
ユーザー rkyrky
提出日時 2017-11-26 19:21:58
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 725 bytes
コンパイル時間 10,597 ms
コンパイル使用メモリ 440,176 KB
実行使用メモリ 62,132 KB
最終ジャッジ日時 2024-04-30 16:26:46
合計ジャッジ時間 16,046 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 349 ms
61,780 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 349 ms
61,788 KB
testcase_05 WA -
testcase_06 AC 360 ms
61,764 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 351 ms
61,824 KB
testcase_10 AC 353 ms
61,788 KB
testcase_11 AC 342 ms
61,672 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:20:10: warning: parameter 'args' is never used
fun main(args: Array<String>){
         ^

ソースコード

diff #

import java.util.Scanner

var input = Scanner(System. `in`)

fun heightList(nama: Int, testCase: Int): MutableList<Int>{
	var list: MutableList<Int> = mutableListOf(nama)
	for(i in 1..testCase - 1) list.add( input.nextInt() )
	return list
}

fun result(list: MutableList<Int>, nama: Int){
	list.sortBy{ it * -1}
	var ele =  Integer.parseInt( (list.indexOf(nama).toString().split(""))[1] )
	if(ele == 0) println("${ele + 1}st")
	else if(ele == 1) println("${ele + 1}nd")
	else if(ele == 2) println("${ele + 1}rd")
	else println("${ele + 1}th")
}

fun main(args: Array<String>){
	var nama: Int = input.nextInt()
	var testCase: Int = input.nextInt()
	var list: MutableList<Int> = heightList(nama, testCase)
	result(list, nama)
}
0