結果

問題 No.3260 岩井スターグラフ
ユーザー 3atnk
提出日時 2025-09-06 13:53:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 612 ms / 2,000 ms
コード長 233 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2025-09-06 13:54:33
合計ジャッジ時間 17,694 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

X,Y,N = map(int,input().split())

for _ in range(N):
    u,v = map(int,input().split())
    if u == 0:
        print((v-1)%Y + 1)
    elif (u-1)//Y == (v-1)//Y:
        print((v-u))
    else:
        print((u-1)%Y + 1 + (v-1)%Y + 1)
0