結果

問題 No.2324 Two Countries within UEC
ユーザー pengin_2000pengin_2000
提出日時 2023-05-28 13:41:18
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 853 ms
コンパイル使用メモリ 28,244 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 08:15:21
合計ジャッジ時間 3,857 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
4,380 KB
testcase_01 AC 95 ms
4,380 KB
testcase_02 AC 17 ms
4,376 KB
testcase_03 AC 68 ms
4,376 KB
testcase_04 AC 77 ms
4,376 KB
testcase_05 AC 18 ms
4,380 KB
testcase_06 AC 32 ms
4,376 KB
testcase_07 AC 14 ms
4,380 KB
testcase_08 AC 64 ms
4,380 KB
testcase_09 AC 68 ms
4,376 KB
testcase_10 AC 95 ms
4,376 KB
testcase_11 AC 87 ms
4,380 KB
testcase_12 AC 27 ms
4,376 KB
testcase_13 AC 27 ms
4,376 KB
testcase_14 AC 17 ms
4,380 KB
testcase_15 AC 14 ms
4,376 KB
testcase_16 AC 63 ms
4,376 KB
testcase_17 AC 41 ms
4,376 KB
testcase_18 AC 18 ms
4,376 KB
testcase_19 AC 93 ms
4,376 KB
testcase_20 AC 12 ms
4,380 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 92 ms
4,380 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 0 ms
4,380 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 0 ms
4,376 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 1 ms
4,376 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 0 ms
4,376 KB
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
long long int modpow(long long int a, long long int n, long long int p)
{
	long long int res = 1;
	for (; n > 0; n /= 2, a = a * a % p)
		if (n % 2 > 0)
			res = res * a % p;
	return res;
}
int main()
{
	long long int n, m, p, q;
	scanf("%lld %lld %lld %lld", &n, &m, &p, &q);
	long long int y;
	long long int x, f;
	long long int ans;
	for (; q > 0; q--)
	{
		scanf("%lld %lld", &x, &f);
		y = f * modpow(x, p - 2, p) % p;
		ans = m / p;
		if (y <= m % p && y!=0)
			ans++;
		printf("%lld\n", ans);
	}
	return 0;
}
0