結果

問題 No.1252 数字根D
ユーザー 👑 tatt61880tatt61880
提出日時 2021-02-15 10:17:33
言語 Kuin
(KuinC++ v.2021.9.17)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 1,857 ms
コンパイル使用メモリ 146,024 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-14 17:08:53
合計ジャッジ時間 2,633 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 5 ms
4,348 KB
testcase_04 AC 7 ms
4,352 KB
testcase_05 AC 8 ms
4,348 KB
testcase_06 AC 8 ms
4,348 KB
testcase_07 AC 7 ms
4,352 KB
testcase_08 AC 8 ms
4,352 KB
testcase_09 AC 8 ms
4,352 KB
testcase_10 AC 8 ms
4,352 KB
testcase_11 AC 7 ms
4,348 KB
testcase_12 AC 7 ms
4,352 KB
testcase_13 AC 8 ms
4,352 KB
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var t: int :: cui@inputInt()
	for(1, t)
		var d: int :: cui@inputInt()
		var a: int :: cui@inputInt()
		var b: int :: cui@inputInt()
		var ans: int :: 0
		do ans :+ (b - a + 1) / (d - 1) * d * (d - 1) / 2
		var s: int :: f(a, d)
		var e: int :: f(b, d)
		if(s = e)
			do ans :+ s
		elif(s < e)
			do ans :+ sig(s, e)
		else
			do ans :+ sig(s, d -1) + sig(1, e)
		end if
		do cui@print("\{ans}\n")
		
		func f(a: int, d: int): int
			ret 1 + (a + d - 2) % (d - 1)
		end func
		
		func sig(s: int, e: int): int
			ret(e * e + e - (s - 1) * (s - 1) - (s - 1)) / 2
		end func
	end for
end func
0