結果

問題 No.358 も~っと!門松列
ユーザー 👑 yumechiyumechi
提出日時 2016-04-24 23:48:22
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 342 ms / 1,000 ms
コード長 723 bytes
コンパイル時間 11,952 ms
コンパイル使用メモリ 426,176 KB
実行使用メモリ 57,616 KB
最終ジャッジ日時 2023-08-12 17:11:40
合計ジャッジ時間 21,794 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 329 ms
57,020 KB
testcase_01 AC 332 ms
56,960 KB
testcase_02 AC 332 ms
56,700 KB
testcase_03 AC 342 ms
56,976 KB
testcase_04 AC 328 ms
56,832 KB
testcase_05 AC 335 ms
57,056 KB
testcase_06 AC 337 ms
57,080 KB
testcase_07 AC 340 ms
57,616 KB
testcase_08 AC 331 ms
56,928 KB
testcase_09 AC 329 ms
56,988 KB
testcase_10 AC 318 ms
57,084 KB
testcase_11 AC 321 ms
57,168 KB
testcase_12 AC 322 ms
56,944 KB
testcase_13 AC 331 ms
56,900 KB
testcase_14 AC 334 ms
57,236 KB
testcase_15 AC 339 ms
57,016 KB
testcase_16 AC 335 ms
57,028 KB
testcase_17 AC 333 ms
56,812 KB
testcase_18 AC 335 ms
57,064 KB
testcase_19 AC 331 ms
57,300 KB
testcase_20 AC 321 ms
56,880 KB
testcase_21 AC 328 ms
56,960 KB
testcase_22 AC 323 ms
56,928 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:9:40: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
	var maxNum = intArrayOf(a, b, c).max()!!
                                       ^
Main.kt:17:27: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
		if(tarr[1] == tarr.max()!! || tarr[1] == tarr.min()!!) {
                          ^
Main.kt:17:54: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
		if(tarr[1] == tarr.max()!! || tarr[1] == tarr.min()!!) {
                                                     ^
Main.kt:27:27: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
		if(tarr[1] == tarr.max()!! || tarr[1] == tarr.min()!!) {
                          ^
Main.kt:27:54: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
		if(tarr[1] == tarr.max()!! || tarr[1] == tarr.min()!!) {
                                                     ^

ソースコード

diff #

import java.util.*;

fun main(args: Array<String>) {
	val cin = Scanner(System.`in`)

	var a = cin.nextInt()
	var b = cin.nextInt()
	var c = cin.nextInt()
	var maxNum = intArrayOf(a, b, c).max()!!

	var res: Int = 0
	for(i in 1..maxNum) {
		var tarr = intArrayOf(a % i, b % i, c % i)
		if(tarr[0] == tarr[1] || tarr[1] == tarr[2] || tarr[2] == tarr[0]) {
			continue
		}
		if(tarr[1] == tarr.max()!! || tarr[1] == tarr.min()!!) {
			res++
		}
	}

	maxNum++
	var tarr = intArrayOf(a % maxNum, b % maxNum, c % maxNum)
	if(tarr[0] == tarr[1] || tarr[1] == tarr[2] || tarr[2] == tarr[0]) {
		println(res)
	} else {
		if(tarr[1] == tarr.max()!! || tarr[1] == tarr.min()!!) {
			println("INF")
		} else {
			println(res)
		}
	}
}
0