結果

問題 No.944 煎っぞ!
ユーザー 👑 tatt61880tatt61880
提出日時 2020-04-25 16:03:19
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 35 ms / 3,000 ms
コード長 866 bytes
コンパイル時間 2,261 ms
コンパイル使用メモリ 151,924 KB
実行使用メモリ 4,640 KB
最終ジャッジ日時 2023-10-14 16:34:21
合計ジャッジ時間 4,607 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
4,424 KB
testcase_01 AC 31 ms
4,368 KB
testcase_02 AC 31 ms
4,476 KB
testcase_03 AC 31 ms
4,524 KB
testcase_04 AC 31 ms
4,408 KB
testcase_05 AC 31 ms
4,536 KB
testcase_06 AC 30 ms
4,532 KB
testcase_07 AC 30 ms
4,472 KB
testcase_08 AC 31 ms
4,532 KB
testcase_09 AC 31 ms
4,436 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 8 ms
4,348 KB
testcase_12 AC 6 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 8 ms
4,352 KB
testcase_15 AC 5 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,352 KB
testcase_18 AC 9 ms
4,348 KB
testcase_19 AC 8 ms
4,348 KB
testcase_20 AC 34 ms
4,472 KB
testcase_21 AC 35 ms
4,640 KB
testcase_22 AC 30 ms
4,480 KB
testcase_23 AC 30 ms
4,500 KB
testcase_24 AC 30 ms
4,556 KB
testcase_25 AC 30 ms
4,376 KB
testcase_26 AC 30 ms
4,524 KB
testcase_27 AC 31 ms
4,520 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 35 ms
4,504 KB
testcase_31 AC 29 ms
4,500 KB
testcase_32 AC 29 ms
4,496 KB
testcase_33 AC 32 ms
4,572 KB
testcase_34 AC 32 ms
4,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@inputInt()
	var x: []int :: #[n]int
	var total: int :: 0
	for i(0, n - 1)
		do x[i] :: cui@inputInt()
		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