結果
| 問題 | 
                            No.2117 中国剰余定理入門
                             | 
                    
| コンテスト | |
| ユーザー | 
                             O--O
                         | 
                    
| 提出日時 | 2022-11-04 21:26:23 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 665 bytes | 
| コンパイル時間 | 1,243 ms | 
| コンパイル使用メモリ | 165,752 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-18 19:11:05 | 
| 合計ジャッジ時間 | 13,434 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 WA * 7 TLE * 3 | 
ソースコード
#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;
}
            
            
            
        
            
O--O