結果
問題 | No.2119 一般化百五減算 |
ユーザー |
![]() |
提出日時 | 2022-11-04 22:49:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 646 bytes |
コンパイル時間 | 4,351 ms |
コンパイル使用メモリ | 250,788 KB |
最終ジャッジ日時 | 2025-02-08 18:12:44 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 WA * 3 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define rep(i, n) for (int i=0; i<n; i++) #define pb push_back typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, M; cin >> N >> M; vector<ll> rs, ms; rep(i, M) { ll Bi, Ci; cin >> Bi >> Ci; Ci %= Bi; if (Ci<0) Ci += Bi; ms.pb(Bi); rs.pb(Ci); } pair<ll, ll> res = crt(rs, ms); if (res.first==0 && res.second==0) cout << "NaN" << endl; else { if (res.first>N) cout << "NaN" << endl; else cout << res.first << endl; } }