結果

問題 No.2558 中国剰余定理
ユーザー coco0715
提出日時 2023-12-11 20:03:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 1,509 ms
コンパイル使用メモリ 164,948 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-27 04:36:48
合計ジャッジ時間 2,464 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//define
#define yes (cout<<"Yes"<<endl)
#define no (cout<<"No"<<endl)
#define ll long long
#define str string
using namespace std;
int inf=2000000000;


int main(){
int A,B,a,b;cin>>A>>B>>a>>b;
int ans=a;
while(1){
    if(ans%A==a&&ans%B==b){
        cout<<ans<<endl;
        return 0;
    }
    else{
        ans+=A;
    }
    //cout<<ans<<endl;
}
}
0