結果

問題 No.3454 Zodiac
コンテスト
ユーザー おのせ
提出日時 2026-02-10 22:07:48
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,422 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,972 ms
コンパイル使用メモリ 277,552 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-02-28 13:06:34
合計ジャッジ時間 5,586 ms
ジャッジサーバーID
(参考情報)
judge7 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
#include <iostream>
#include <cmath>
using namespace std;
using namespace atcoder;
using ll = long long;
using lb = long double;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvll = vector<vector<ll>>;
using vP = vector<P>;
using Graph = vector<vector<ll>>;
using WGraph = vector<vector<pair<ll, ll>>>; // コスト、頂点番号の順
using mint = modint998244353;
//using mint = long double;
#define rep0(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
mt19937_64 rng(58);
long double PI = 3.14159265358979;
const ll LLMAX = 9223372036854775807;
const ll INF = 1e18;
vector<ll> di = {-1, 0, 1, 0}; // 上左下右
vector<ll> dj = {0, -1, 0, 1};
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }

int main() {
    ll P, Q, Y, p, q, y;
    cin >> P >> Q >> Y >> p >> q >> y;

    p--; q--;
    if (Y < y) {
        while (Y < y) {
            p++; q++;
            p %= P; q %= Q;
            Y++;
        }
    }
    else {
        while (Y > y) {
            p--; q--;
            p = (p + P) % P;
            q = (q + Q) % Q;
            Y--;
        }
    }

    cout << p + 1 << ' ' << q + 1 << endl;
    return 0;
}
0