結果

問題 No.3260 岩井スターグラフ
ユーザー ねしん
提出日時 2025-09-06 15:00:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 616 ms / 2,000 ms
コード長 261 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 82,152 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2025-09-06 15:00:20
合計ジャッジ時間 18,743 ms
ジャッジサーバーID
(参考情報)
judge / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

X, Y, N = list(map(int,input().split()))
for i in range(N):
	U, V = list(map(int,input().split()))
	if U == 0:
		if V % Y == 0:
			print(Y)
		else:
			print(V % Y)
		continue
	U -= 1
	V -= 1
	if U // Y == V // Y:
		print(V - U)
	else:
		print(U % Y + V % Y + 2)
0