結果

問題 No.2324 Two Countries within UEC
ユーザー tatt61880
提出日時 2023-07-24 20:06:10
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 1,493 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 5,657 ms
コンパイル使用メモリ 146,980 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-01 15:21:21
合計ジャッジ時間 27,919 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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}\n")
	end for
end func
0