結果
問題 | No.2558 中国剰余定理 |
ユーザー |
|
提出日時 | 2023-12-02 14:36:02 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 553 bytes |
コンパイル時間 | 1,926 ms |
コンパイル使用メモリ | 198,652 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-26 16:56:35 |
合計ジャッジ時間 | 2,930 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 27 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < (n); i++) template<typename T> inline bool chmax(T &a, T b) {return ((a < b) ? (a = b, true) : (false));} template<typename T> inline bool chmin(T &a, T b) {return ((a > b) ? (a = b, true) : (false));} typedef long long ll; typedef pair<ll,ll> P; int main() { ll A, B, a, b; cin >> A >> B >> a >> b; ll x = A + a; while(1) { if(x % B == b) { cout << x << endl; break; } x += A; } return 0; }