結果

問題 No.2117 中国剰余定理入門
ユーザー O--OO--O
提出日時 2022-11-04 21:26:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 665 bytes
コンパイル時間 1,424 ms
コンパイル使用メモリ 163,524 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-25 23:40:18
合計ジャッジ時間 13,312 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 TLE -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1,998 ms
4,376 KB
testcase_08 TLE -
testcase_09 AC 1 ms
4,380 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 2 ms
4,384 KB
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 2 ms
4,504 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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