16652022-12-01 13:15:181478A sárkány feladványa (50)cpp11Elfogadva 50/503ms4268 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> p32;
typedef pair<ll, ll> p64;
typedef pair<double, double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int>> vv32;
typedef vector<vector<ll>> vv64;
typedef vector<vector<p64>> vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i, e) for (ll i = 0; i < e; i++)
#define forsn(i, s, e) for (ll i = s; i < e; i++)
#define rforn(i, s) for (ll i = s; i >= 0; i--)
#define rforsn(i, s, e) for (ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout << #x << " = " << x << ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())

long long lnko(long long a, long long b)
{
    long long tmp;
    while (b)
    {
        tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

long long lkkt(long long a, long long b)
{
    return a * b / lnko(a, b);
}

long long szamolo(long long a)
{
    long long db = 0;
    while (a)
    {
        a /= 10;
        db++;
    }
    return db;
}

int main()
{
    //ifstream cin("be.txt");
    for (int p = 1; p <= 3; p++)
    {
        long long a, b, db;
        cin >> a >> b >> db;
        long long tobbszoros = lkkt(a, b);
        long long tobbszorosDb = szamolo(tobbszoros);
        if (tobbszorosDb > db)
            cout << -1;
        else
        {
            cout << tobbszoros;
            for (int i = tobbszorosDb + 1; i <= db; i++)
                cout << 0;
        }
        cout << ln;
    }
    return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/03ms1876 KiB
2Elfogadva0/02ms2064 KiB
3Elfogadva3/32ms2268 KiB
4Elfogadva3/32ms2480 KiB
5Elfogadva3/32ms2680 KiB
6Elfogadva3/32ms2928 KiB
7Elfogadva3/32ms3172 KiB
8Elfogadva3/32ms3340 KiB
9Elfogadva3/32ms3368 KiB
10Elfogadva3/32ms3496 KiB
11Elfogadva3/32ms3744 KiB
12Elfogadva3/32ms4088 KiB
13Elfogadva4/42ms4096 KiB
14Elfogadva4/42ms4208 KiB
15Elfogadva4/42ms4104 KiB
16Elfogadva4/42ms4232 KiB
17Elfogadva4/42ms4268 KiB