結果

問題 No.2558 中国剰余定理
ユーザー yumekawayuiyumekawayui
提出日時 2023-12-02 14:34:09
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 1,145 bytes
コンパイル時間 3,472 ms
コンパイル使用メモリ 185,712 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2023-12-02 14:35:07
合計ジャッジ時間 5,893 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
6,548 KB
testcase_01 AC 64 ms
6,548 KB
testcase_02 AC 35 ms
6,548 KB
testcase_03 AC 39 ms
6,548 KB
testcase_04 AC 36 ms
6,548 KB
testcase_05 AC 62 ms
6,548 KB
testcase_06 AC 49 ms
6,548 KB
testcase_07 AC 68 ms
6,548 KB
testcase_08 AC 38 ms
6,548 KB
testcase_09 AC 43 ms
6,548 KB
testcase_10 AC 39 ms
6,548 KB
testcase_11 AC 37 ms
6,548 KB
testcase_12 AC 39 ms
6,548 KB
testcase_13 AC 39 ms
6,548 KB
testcase_14 AC 38 ms
6,548 KB
testcase_15 AC 39 ms
6,548 KB
testcase_16 AC 49 ms
6,548 KB
testcase_17 AC 40 ms
6,548 KB
testcase_18 AC 40 ms
6,548 KB
testcase_19 AC 39 ms
6,548 KB
testcase_20 AC 37 ms
6,548 KB
testcase_21 AC 40 ms
6,548 KB
testcase_22 AC 40 ms
6,548 KB
testcase_23 AC 40 ms
6,548 KB
testcase_24 AC 38 ms
6,548 KB
testcase_25 AC 40 ms
6,548 KB
testcase_26 AC 39 ms
6,548 KB
testcase_27 AC 39 ms
6,548 KB
testcase_28 AC 39 ms
6,548 KB
testcase_29 AC 37 ms
6,548 KB
testcase_30 AC 37 ms
6,548 KB
testcase_31 AC 37 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/extc++.h>
using namespace std;
using ld = long double; 
const vector<int> dx = {0, 0, 1, -1};
const vector<int> dy = {1, -1, 0, 0};
#define vec vector
#define int long long
#define double long double
//cout<<setprecision(10)<<fixed<<..
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repp(i, x, n) for (int i = x; i < (int)(n); i++)
#define pii pair<int,int>
#define pq priority_queue
#define all(V) begin(V),end(V)
#define printpair(p) cout<<p.first<<" "<<p.second<<"\n"
#define tple tuple<int,int,int>
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
#define mend(a,b) G[a].push_back(b)

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    
    int A,B,a,b;cin>>A>>B>>a>>b;
    int ans=1e18;
    for(int i=0;i<=10000000;i++){
        if(i%A==a&&i%B==b){
            chmin(ans,i);
        }
    }
    cout<<ans<<"\n";

}
0