結果
| 問題 |
No.2558 中国剰余定理
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-02 14:42:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 1,406 bytes |
| コンパイル時間 | 1,605 ms |
| コンパイル使用メモリ | 191,884 KB |
| 最終ジャッジ日時 | 2025-02-18 03:49:13 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <string>
using namespace std;
//https://shibh308.hatenablog.com/entry/2018/02/19/205716
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
#define dump(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl
#define ALL(obj) (obj).begin(),(obj).end()
#define COUT(x) cout<<(x)<<endl
#define BOOLANS(x) if(x){cout << "Yes" << "\n";} else {cout << "No" << "\n";}
int main(){
int A,B,a,b;
cin >>A >> B >> a >> b;
int ans;
for(int x =0;;x++){
if((x % A) == a){
if((x % B) == b){
ans = x;
break;
}
}
}
COUT(ans);
}