結果

問題 No.2324 Two Countries within UEC
ユーザー NP
提出日時 2023-05-28 15:13:16
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 261 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 114,560 KB
最終ジャッジ日時 2024-12-27 05:14:48
合計ジャッジ時間 99,045 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 TLE * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, P, Q = map(int, input().split())

def count_towns(x, f):
    count = 0
    for y in range(1, M + 1):
        if (x * y) % P == f:
            count += 1
    return count

for _ in range(Q):
    x, f = map(int, input().split())
    print(count_towns(x, f))
0