結果

問題 No.3260 岩井スターグラフ
ユーザー Yama.can
提出日時 2025-09-06 13:24:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 530 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 1,924 ms
コンパイル使用メモリ 194,992 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-06 13:25:31
合計ジャッジ時間 16,906 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main()
{
	#define int long long
	int x, y, n;
	cin >> x >> y >> n;
	for(int i = 0; i < n; i++)
	{
		int u, v;
		cin >> u >> v;
		u--;v--;
		if(u == -1)
		  cout << v % y + 1 << endl;
		else if(v / y == u / y)
		  cout << v % y - u % y << endl;
		else 
		  cout << u % y + v % y + 2 << endl;
	}
}
0