結果

問題 No.2324 Two Countries within UEC
コンテスト
ユーザー NP
提出日時 2023-05-28 15:13:16
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 261 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 349 ms
コンパイル使用メモリ 85,244 KB
実行使用メモリ 75,520 KB
最終ジャッジ日時 2026-06-01 22:10:19
合計ジャッジ時間 7,178 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other TLE * 1 -- * 40
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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