結果
| 問題 |
No.3179 3 time mod
|
| コンテスト | |
| ユーザー |
北杜
|
| 提出日時 | 2025-06-14 06:18:50 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 924 bytes |
| コンパイル時間 | 2,911 ms |
| コンパイル使用メモリ | 278,592 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-06-14 06:18:56 |
| 合計ジャッジ時間 | 4,870 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 42 |
ソースコード
//#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%R!=C){
B+=lcm(P, Q);
if(A>N||B>N||C>N){
cout << 0 << endl;
return 0;
}
}
cout << (N-B)/lcm(P, lcm(Q, R))+1 << endl;
return 0;
}
北杜