結果

問題 No.3260 岩井スターグラフ
ユーザー GOTKAKO
提出日時 2025-09-06 13:03:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 1,957 ms
コンパイル使用メモリ 191,464 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-06 13:03:53
合計ジャッジ時間 6,893 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int X,Y,N; cin >> X >> Y >> N;
    while(N--){
        long long u,v; cin >> u >> v;
        if(u == 0){
            cout << (v-1)%Y+1 << "\n";
            continue;
        }
        u--,v--;
        if(u/Y == v/Y) cout << v-u << "\n";
        else cout << u%Y+2+v%Y << "\n";
    }
}
0