結果

問題 No.2117 中国剰余定理入門
コンテスト
ユーザー O--O
提出日時 2022-11-04 21:26:23
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 665 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 845 ms
コンパイル使用メモリ 183,380 KB
実行使用メモリ 191,348 KB
最終ジャッジ日時 2026-04-02 12:10:46
合計ジャッジ時間 10,399 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge4_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define int ll
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin() , x.end()
#define pii pair<int , int>
#define pb emplace_back
#define F first
#define S second
const int mod = 1e9 + 7;
const int MAXX = 1e5 + 5;

int a , b , c , d;

signed main()
{
    _FastIO;
    cin >> b >> a >> d >> c;
    if(a < 0)
        a = b + a;
    if(c < 0)
        c = d + c;
    for(int i = 0; i <= 200000000; i++){
        if((i % b == a) && (i % d == c)){
            cout << i << endl;
            return 0;
        }
    }
    cout << "NaN" << endl;
    return 0;
}
0