結果

問題 No.944 煎っぞ!
ユーザー 👑 tatt61880tatt61880
提出日時 2020-03-31 00:00:10
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 50 ms / 3,000 ms
コード長 916 bytes
コンパイル時間 2,375 ms
コンパイル使用メモリ 163,332 KB
実行使用メモリ 18,716 KB
最終ジャッジ日時 2023-10-14 16:03:53
合計ジャッジ時間 6,046 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
18,500 KB
testcase_01 AC 45 ms
18,368 KB
testcase_02 AC 44 ms
18,592 KB
testcase_03 AC 44 ms
18,556 KB
testcase_04 AC 45 ms
18,380 KB
testcase_05 AC 44 ms
18,440 KB
testcase_06 AC 45 ms
18,624 KB
testcase_07 AC 45 ms
18,700 KB
testcase_08 AC 46 ms
18,616 KB
testcase_09 AC 44 ms
18,572 KB
testcase_10 AC 3 ms
4,352 KB
testcase_11 AC 11 ms
6,752 KB
testcase_12 AC 7 ms
5,276 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 12 ms
6,844 KB
testcase_15 AC 6 ms
5,060 KB
testcase_16 AC 2 ms
4,352 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 12 ms
6,636 KB
testcase_19 AC 11 ms
6,580 KB
testcase_20 AC 50 ms
18,692 KB
testcase_21 AC 50 ms
18,464 KB
testcase_22 AC 44 ms
18,412 KB
testcase_23 AC 43 ms
18,432 KB
testcase_24 AC 43 ms
18,716 KB
testcase_25 AC 44 ms
18,404 KB
testcase_26 AC 43 ms
18,628 KB
testcase_27 AC 46 ms
17,552 KB
testcase_28 AC 2 ms
4,352 KB
testcase_29 AC 2 ms
4,352 KB
testcase_30 AC 49 ms
18,592 KB
testcase_31 AC 44 ms
18,712 KB
testcase_32 AC 44 ms
18,548 KB
testcase_33 AC 48 ms
18,404 KB
testcase_34 AC 48 ms
18,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@input().toInt(&)
	var ss: [][]char :: cui@input().split(" ")
	var x: []int :: #[n]int
	var total: int :: 0
	for i(0, n - 1)
		do x[i] :: ss[i].toInt(&)
		do total :+ x[i]
	end for
	func getDivisors(n: int): []int
		var res: []int :: #[0]int
		var i: int :: 1
		while loop(true)
			if(i * i > n)
				break loop
			end if
			if(n % i = 0)
				do res :~ [i]
			end if
			if(n / i <> i)
				do res :~ [n / i]
			end if
			do i :+ 1
		end while
		do res.sort()
		ret res
	end func
	var divisors: []int :: getDivisors(total)
	
	var ans: int :: 0
	for i(0, ^divisors - 1)
		var divisor: int :: divisors[i]
		var sum: int :: 0
		var cnt: int :: 0
		for j(0, n - 1)
			do sum :+ x[j]
			if(sum > divisor)
				skip i
			end if
			if(sum = divisor)
				do cnt :+ 1
				do sum :: 0
			end if
		end for
		if(sum = 0)
			do ans :: cnt
			break i
		end if
	end for
	do cui@print("\{ans}\n")
end func
0