結果

問題 No.2125 Inverse Sum
ユーザー 👑 tatt61880tatt61880
提出日時 2023-03-19 22:40:58
言語 Kuin
(KuinC++ v.2021.9.17)
結果
WA  
実行時間 -
コード長 677 bytes
コンパイル時間 4,540 ms
コンパイル使用メモリ 148,100 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-18 17:54:48
合計ジャッジ時間 5,286 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,348 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,348 KB
testcase_22 WA -
testcase_23 AC 2 ms
4,348 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1 ms
4,348 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 1 ms
4,348 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var p: int :: cui@inputInt()
	var q: int :: cui@inputInt()
	
	if(p = q)
		do cui@print("1\n2 2\n")
		ret
	end if
	
	var gcd: int :: math@gcd(p, q)
	do p :/ gcd
	do q :/ gcd
	
	; n = a * c
	; m = b * c
	; p = a + b
	; q = a * b * c
	
	var ansN: []int :: #[0]int
	var ansM: []int :: #[0]int
	
	for a(1, p - 1)
		var b: int :: p - a
		if(a * b > q)
			break a
		end if
		if(q % (a * b) = 0)
			var c: int :: q / (a * b)
			var n: int :: a * c
			var m: int :: b * c
			do ansN :~ [n]
			do ansM :~ [m]
		end if
	end for
	
	do cui@print("\{^ansN}\n")
	for i(0, ^ansN - 1)
		var n: int :: ansN[i]
		var m: int :: ansM[i]
		do cui@print("\{n} \{m}\n")
	end for
end func
0