結果

問題 No.708 (+ー)の式
ユーザー 👑 tatt61880tatt61880
提出日時 2020-07-11 20:32:38
言語 Kuin
(KuinC++ v.2021.9.17)
結果
RE  
実行時間 -
コード長 546 bytes
コンパイル時間 2,804 ms
コンパイル使用メモリ 147,264 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-14 16:57:58
合計ジャッジ時間 4,369 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

func f(s: []char, i: &int): int
	var res: int :: @g(s, &i)
	while(true)
		switch c(s[i])
		case '+', '-'
			do i :+ 1
			do res :+ @g(s, &i) * (c = '-' ?(-1, 1))
		default
			do i :+ 1
			ret res
		end switch
	end while
	ret 0
end func

func g(s: []char, i: &int): int
	switch c(s[i])
	case '0' to '9'
		do i :+ 1
		ret c $ int - '0' $ int
	case '('
		do i :+ 1
		ret @f(s, &i)
	end switch
	ret 0
end func

func main()
	var s: []char :: cui@input()
	var n: int :: ^s
	var i: int :: 0
	var ans: int :: @f(s, &i)
	do cui@print("\{ans}\n")
end func
0