提出 #66810336


ソースコード 拡げる

//  ↘ ⬇ ⬇ ⬇ ⬇ ⬇ ↙
//  ➡ @roadfromroi ⬅
//  ↗ ⬆ ⬆ ⬆ ⬆ ⬆ ↖
/*
░░░░░░░█▐▓▓░████▄▄▄█▀▄▓▓▓▌█
░░░░░▄█▌▀▄▓▓▄▄▄▄▀▀▀▄▓▓▓▓▓▌█
░░░▄█▀▀▄▓█▓▓▓▓▓▓▓▓▓▓▓▓▀░▓▌█
░░█▀▄▓▓▓███▓▓▓███▓▓▓▄░░▄▓▐█▌
░█▌▓▓▓▀▀▓▓▓▓███▓▓▓▓▓▓▓▄▀▓▓▐█
▐█▐██▐░▄▓▓▓▓▓▀▄░▀▓▓▓▓▓▓▓▓▓▌█▌
█▌███▓▓▓▓▓▓▓▓▐░░▄▓▓███▓▓▓▄▀▐█
█▐█▓▀░░▀▓▓▓▓▓▓▓▓▓██████▓▓▓▓▐█
▌▓▄▌▀░▀░▐▀█▄▓▓██████████▓▓▓▌█▌
▌▓▓▓▄▄▀▀▓▓▓▀▓▓▓▓▓▓▓▓█▓█▓█▓▓▌█▌
█▐▓▓▓▓▓▓▄▄▄▓▓▓▓▓▓█▓█▓█▓█▓▓▓▐█ йоу
 */
#include "queue"
#include <iostream>
#include "vector"
#include "algorithm"
#include "numeric"
#include "climits"
#include "iomanip"
#include "bitset"
#include "cmath"
#include "map"
#include "deque"
#include "array"
#include "set"
#include "ranges"
#define all(x) x.begin(), x.end()
using namespace std;
#define int long long
int dig(int a) {
    return to_string(a).size();
}
void solve() {
    int a = rand() % 17 + 1, b = rand() % 17 + 1, c = rand() % 17 + 1;
    cin >> a >> b >> c;
    if (a + b == c) {
        string t1(a, '9');
        string t2(b, '9');
        t2.back() = '8';
        int v1 = stoll(t1), v2 = stoll(t2);
        if (dig(v1 * v2) != c)
            exit(1);
        cout << "Yes\n" << t1 << ' ' << t2 << '\n';
        return;
    }
    if (a + b < c or max(a, b) > c) {
        cout << "No\n";
        return;
    }
    int base = 1;
    for (int i = 0; i < 60; ++i) {
        int v1 = base, v2 = base;
        int lstbase = base;
        base *= 2;
        if (dig(v1) > a)
            continue;
        if (dig(v2) > b)
            continue;
        while (dig(v1) < a) {
            v1 *= 3;
        }
        while (dig(v2) < b) {
            v2 *= 5;
        }
        __int128 r = (v1/lstbase) * (__int128)v2;
        int x = r;
        if ((__int128)x != r)
            continue;
        if (dig(x) != c)
            continue;
        cout << "Yes\n";
        cout << v1 << ' ' << v2 << '\n';
        return;
    }
    //cout << a << ' ' << b << ' ' << c << '\n';
    cout << "No\n";
    exit(1);
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int t=1;
    cin >> t;
    while (t--) {
        solve();
    }
}
/*
1
2
49464 69440
49412 69367
 */

提出情報

提出日時
問題 B - LCM
ユーザ SomethingNew
言語 C++ 20 (gcc 12.2)
得点 600
コード長 2859 Byte
結果 AC
実行時間 25 ms
メモリ 3544 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 600 / 600
結果
AC × 1
AC × 4
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3476 KiB
01_handmade_00.txt AC 6 ms 3480 KiB
01_handmade_01.txt AC 25 ms 3544 KiB
01_handmade_02.txt AC 2 ms 3480 KiB