結果

問題 No.2324 Two Countries within UEC
ユーザー tatt61880
提出日時 2023-07-24 20:15:45
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 1,770 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 9,716 ms
コンパイル使用メモリ 147,112 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-20 11:36:24
合計ジャッジ時間 30,196 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@inputInt()
	var m: int :: cui@inputInt()
	var p: int :: cui@inputInt()
	var q: int :: cui@inputInt()
	for(1, q)
		var x: int :: cui@inputInt()
		var f: int :: cui@inputInt()
		
		var ans: int :: 0
		
		if(x % p = 0)
			if(f = 0)
				do ans :: m
			else
				do ans :: 0
			end if
		else
			var target: int :: f * math@modPow(x, p - 2, p) % p
			
			do ans :: m / p
			if(f <> 0)
				do ans :+ (m % p < target ?(0, 1))
			end if
		end if
		
		do cui@print(ans.toStr() ~ "\n")
	end for
end func
0