Submission #47208844


Source Code Expand

#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>
#include <unordered_map>

using namespace std;
typedef long long ll;


int main(){
    ll n;
    cin >> n;
    
    bool ok = false;
    
    for(ll i = 1; i <= 100; i++){
        ll ans = 1;
        
        for(int j = 0; j < i; j++){
            ans = (ans * i);
            if(ans > n)
                break;
        }
        if(ans == n){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
     
    return 0;
}

Submission Info

Submission Time
Task B - A^A
User Ksusha
Language C++ 20 (gcc 12.2)
Score 200
Code Size 791 Byte
Status AC
Exec Time 1 ms
Memory 3580 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:27:10: warning: unused variable ‘ok’ [-Wunused-variable]
   27 |     bool ok = false;
      |          ^~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 21
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 02_hack_1_00.txt, 02_hack_1_01.txt, 03_hack_2_00.txt, 03_hack_2_01.txt, 03_hack_2_02.txt, 03_hack_2_03.txt, 04_corner_00.txt, 04_corner_01.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3572 KiB
00_sample_01.txt AC 1 ms 3436 KiB
00_sample_02.txt AC 1 ms 3560 KiB
01_random_00.txt AC 1 ms 3500 KiB
01_random_01.txt AC 1 ms 3464 KiB
01_random_02.txt AC 1 ms 3436 KiB
01_random_03.txt AC 1 ms 3484 KiB
01_random_04.txt AC 1 ms 3372 KiB
01_random_05.txt AC 1 ms 3452 KiB
01_random_06.txt AC 1 ms 3488 KiB
01_random_07.txt AC 1 ms 3436 KiB
01_random_08.txt AC 1 ms 3508 KiB
01_random_09.txt AC 1 ms 3440 KiB
02_hack_1_00.txt AC 1 ms 3488 KiB
02_hack_1_01.txt AC 1 ms 3432 KiB
03_hack_2_00.txt AC 1 ms 3488 KiB
03_hack_2_01.txt AC 1 ms 3580 KiB
03_hack_2_02.txt AC 1 ms 3432 KiB
03_hack_2_03.txt AC 1 ms 3500 KiB
04_corner_00.txt AC 1 ms 3464 KiB
04_corner_01.txt AC 1 ms 3484 KiB