提出 #17737988


ソースコード 拡げる

/*
ID: Imtiaz_Riton
TASK: friday
LANG: C++                 
*/
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define nl "\n";
#define ii pair<int, int>
#define inf 1<<29
using namespace std;

const int M = 5e5 + 7;

ll mul(int n, int b){

    ll res = 1;

    for(int i = 1; i <= n; i++) res *= b;

    return res;
}

void solve()
{   
    ll n;
    cin >> n;

    for(int i = 1; i < 40; i++){

        ll val1 = mul(i, 5);
        
        if(val1 >= 1e18) break;

        for(int j = 1; j <= 60; j++){

            ll val2 = mul(j, 3);

            //cout << val2 << ' ' << val1 << nl;

            if(val2 >= 1e18) break;

            if(val1 + val2 == n){

                cout << j << ' ' << i << nl;

                return;
            }
        }
    }

    cout << "-1" << nl;
    return;
}

int main()
{
    //freopen("friday.in", "r", stdin);
    //freopen("friday.out","w", stdout);    
    ios_base::sync_with_stdio(false), cin.tie(0);

    int t = 1;
    //cin >> t;

    while (t--)
    {

        solve();
    }

    return 0;
}

提出情報

提出日時
問題 A - 106
ユーザ Imtiaz_Riton
言語 C++ (GCC 9.2.1)
得点 300
コード長 1139 Byte
結果 AC
実行時間 11 ms
メモリ 3568 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 22
セット名 テストケース
Sample 00_sample_00, 00_sample_01, 00_sample_02
All 00_sample_00, 00_sample_01, 00_sample_02, 01_test_00, 01_test_01, 01_test_02, 01_test_03, 01_test_04, 01_test_05, 01_test_06, 01_test_07, 01_test_08, 01_test_09, 01_test_10, 01_test_11, 01_test_12, 01_test_13, 01_test_14, 01_test_15, 01_test_16, 01_test_17, 02_beet_killer
ケース名 結果 実行時間 メモリ
00_sample_00 AC 11 ms 3512 KiB
00_sample_01 AC 2 ms 3496 KiB
00_sample_02 AC 2 ms 3448 KiB
01_test_00 AC 5 ms 3456 KiB
01_test_01 AC 2 ms 3460 KiB
01_test_02 AC 2 ms 3524 KiB
01_test_03 AC 2 ms 3488 KiB
01_test_04 AC 2 ms 3508 KiB
01_test_05 AC 2 ms 3464 KiB
01_test_06 AC 3 ms 3512 KiB
01_test_07 AC 2 ms 3500 KiB
01_test_08 AC 2 ms 3508 KiB
01_test_09 AC 2 ms 3512 KiB
01_test_10 AC 2 ms 3512 KiB
01_test_11 AC 2 ms 3464 KiB
01_test_12 AC 2 ms 3520 KiB
01_test_13 AC 3 ms 3460 KiB
01_test_14 AC 2 ms 3464 KiB
01_test_15 AC 2 ms 3460 KiB
01_test_16 AC 2 ms 3496 KiB
01_test_17 AC 4 ms 3512 KiB
02_beet_killer AC 2 ms 3568 KiB