結果
| 問題 | No.2558 中国剰余定理 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-12-02 15:00:49 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 30 ms / 2,000 ms | 
| コード長 | 668 bytes | 
| コンパイル時間 | 612 ms | 
| コンパイル使用メモリ | 65,884 KB | 
| 最終ジャッジ日時 | 2025-02-18 04:08:51 | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 | 
ソースコード
/**
 * @file 2558.cpp
 * @brief yukicoder problem 2558
 * @author Keitaro Naruse
 * @date 2023-12-02
 * @copyright MIT License
 * @details https://yukicoder.me/problems/no/2558
 * */
// # Solution
#include <iostream>
int main( ) {
    //  Read A, B = [ 1, 3*10^3 ], a = [ 0, A ), b = [ 0, B )
    int A, B, a, b;
    std::cin >> A >> B >> a >> b;
    //  Main::Preprocess
    //  Main::Find a solution
    int answer = 0;
    for( int x = 0; x < A * B; x++ ) {
        if( x % A == a && x % B == b ) {
            answer = x;
            break;
        }
    }
    //  Main::Output a solution
    std::cout << answer << std::endl;
    //  Finalize
    return 0;
}
            
            
            
        