結果
問題 |
No.3179 3 time mod
|
ユーザー |
![]() |
提出日時 | 2025-06-13 21:31:49 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 793 bytes |
コンパイル時間 | 5,109 ms |
コンパイル使用メモリ | 335,472 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-06-13 21:31:58 |
合計ジャッジ時間 | 6,456 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 1 WA * 40 |
ソースコード
#include <atcoder/all> #include <bits/stdc++.h> #define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) using namespace atcoder; using namespace std; typedef long long ll; using mint = modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(12); ll n, p, q, r, a, b, c; cin >> n >> p >> q >> r >> a >> b >> c; vector<ll> M = {p, q, r}; vector<ll> R = {a, b, c}; auto P = crt(R, M); pair<ll, ll> zero = {0, 0}; if (P == zero) { cout << 0 << endl; return 0; } if (P.first == 0) { cout << n + 1 << endl; return 0; } ll ans = n - P.second; if (ans < 0) { cout << 0 << endl; return 0; } cout << ans / P.first + 1 << endl; }