結果
問題 |
No.3179 3 time mod
|
ユーザー |
![]() |
提出日時 | 2025-06-13 22:04:41 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 985 bytes |
コンパイル時間 | 3,100 ms |
コンパイル使用メモリ | 278,572 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-13 22:04:49 |
合計ジャッジ時間 | 6,312 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | TLE * 1 -- * 40 |
ソースコード
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #include <atcoder/modint> using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() using ll = long long; const ll INF32 = 2e9; const ll INF64 = 4e18; using namespace atcoder; using mint = modint998244353; // 勘. void printYN(bool ok){ if(ok)cout << "Yes" << endl; else cout << "No" << endl; return; } int main() { ll N, P, Q, R, A, B, C; cin >> N >> P >> Q >> R >> A >> B >> C; while(A!=B){ if(A<B){ A+=P; } if(B<A){ B+=Q; } if(A>N||B>N||C>N){ cout << 0 << endl; return 0; } } while(B!=C){ if(B<C){ B+=lcm(P, Q); } if(C<B){ C+=R; } if(A>N||B>N||C>N){ cout << 0 << endl; return 0; } } cout << (N-B)/lcm(P, lcm(Q, R))+1 << endl; return 0; }