結果

問題 No.967 引き算をして門松列(その2)
ユーザー 👑 tatt61880tatt61880
提出日時 2020-04-25 16:06:28
言語 Kuin
(KuinC++ v.2021.9.17)
結果
RE  
実行時間 -
コード長 1,296 bytes
コンパイル時間 2,102 ms
コンパイル使用メモリ 157,212 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-14 16:34:46
合計ジャッジ時間 4,789 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var t: int :: cui@inputInt()
	for(1, t)
		var ss: [][]char :: cui@input().split(" ")
		var A: int :: cui@inputInt()
		var B: int :: cui@inputInt()
		var C: int :: cui@inputInt()
		var x: int :: cui@inputInt()
		var y: int :: cui@inputInt()
		var z: int :: cui@inputInt()
		
		; bが最大のとき
		var ans1: int :: -1
		block
			var a: int :: A
			var b: int :: B
			var c: int :: C
			var cnt: int :: 0
			if(a >= b)
				do cnt :+ (a - (b - 1)) * x
				do a :: b - 1
			end if
			if(c >= b)
				do cnt :+ (c - (b - 1)) * z
				do c :: b - 1
			end if
			if(a = c)
				do cnt :+ lib@min(x, z)
				do a :- 1
			end if
			if(a > 0 & c > 0)
				do ans1 :: cnt
			end if
		end block
		
		; bが最小のとき
		var ans2: int :: -1
		block
			var a: int :: A
			var b: int :: B
			var c: int :: C
			var cnt: int :: 0
			if(a = c)
				do cnt :+ lib@min(x, z)
				do a :- 1
			end if
			var target: int :: lib@min(a, c)
			if(b >= target)
				do cnt :+ (b - (target - 1)) * y
				do b :: target - 1
			end if
			if(b > 0)
				do ans2 :: cnt
			end if
		end block
		
		var ans: int :: -1
		if(ans1 >= 0)
			do ans :: ans1
		end if
		if(ans2 >= 0)
			if(ans >= 0)
				do ans :: lib@min(ans, ans2)
			else
				do ans :: ans2
			end if
		end if
		do cui@print("\{ans}\n")
	end for
end func
0