結果
問題 | No.2117 中国剰余定理入門 |
ユーザー |
![]() |
提出日時 | 2022-11-04 21:26:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 632 bytes |
コンパイル時間 | 800 ms |
コンパイル使用メモリ | 99,712 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 19:09:43 |
合計ジャッジ時間 | 1,308 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <queue> #include <set> #include <random> #include <iomanip> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) template<class T> using vi = vector<T>; template<class T> using vii = vector<vi<T>>; template<class T> using viii = vector<vii<T>>; void chmax(ll & x, ll y) { x = max(x, y); } int main() { int b0, c0, b1, c1; cin >> b0 >> c0 >> b1 >> c1; rep(i, b0 * b1) { if ((i - c0) % b0) continue; if ((i - c1) % b1) continue; cout << i << endl; return 0; } cout << "NaN" << endl; return 0; }