結果

問題 No.1252 数字根D
ユーザー 👑 tatt61880tatt61880
提出日時 2021-02-15 09:56:52
言語 Kuin
(KuinC++ v.2021.9.17)
結果
WA  
実行時間 -
コード長 598 bytes
コンパイル時間 2,026 ms
コンパイル使用メモリ 145,456 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2023-10-14 17:09:00
合計ジャッジ時間 5,897 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

func main()
	var t: int :: cui@inputInt()
	for(0, t - 1)
		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 start: int :: f(a, d)
		var dd: int :: d - 1
		for i(start, start + (b - a + dd) % dd)
			do ans :+ 1 + (i + dd - 1) % dd
		end for
		do cui@print("\{ans}\n")
		
		func f(a: int, d: int): int
			var res: int :: 0
			while(a <> 0)
				do res :+ a % d
				do a :/ d
			end while
			if(res >= d)
				ret f(res, d)
			else
				ret res
			end if
		end func
	end for
end func
0