結果

問題 No.1819 Mirrored 2
ユーザー hiikunZhiikunZ
提出日時 2022-05-14 18:22:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,381 bytes
コンパイル時間 1,976 ms
コンパイル使用メモリ 201,440 KB
実行使用メモリ 253,564 KB
最終ジャッジ日時 2023-09-30 10:23:11
合計ジャッジ時間 6,792 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//#include<atcoder/all>
//using namespace atcoder;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
constexpr ll MAX = 2000000000000000000;
constexpr ld PI = 3.14159265358979;
constexpr ll MOD = 0;//2024948111;
ld dotorad(ld K){return PI * K / 180.0;}
ld radtodo(ld K){return K * 180.0 / PI;}
mt19937 mt;
void randinit(){srand((unsigned)time(NULL));mt = mt19937(rand());}
int main(){
    ll P,Q,X,Y;
    cin >> P >> Q >> X >> Y;
    while(Y % 10 == 0){
        Y += Q;
    }
    string y = to_string(Y);
    string S = y;
    reverse(S.begin(),S.end());
    ll f = stol(S) % P;
    while(1){
        if(f == X){
            cout << S << endl;
            {
                ll p = 0;
                for(ll i = 0;i < (ll)S.size();i++){
                    p = (p * 10) % P;
                    p += S[i] - '0';
                    p %= P;
                }
                if(p != X % P) cout << "Error" << endl;
            }
            {
                ll p = 0;
                for(ll i = (ll)S.size() - 1;i >= 0;i--){
                    p = (p * 10) % Q;
                    p += S[i] - '0';
                    p %= Q;
                }
                if(p != Y % Q) cout << "Error" << endl;
            }
            return 0;
        }
        S += "0";
        f = (f * 10) % P;
    }
}
0