Submission #47270597
Source Code Expand
#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <vector>
#include <stack>
#include <algorithm>
typedef long l;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
template<class T> void read(T &x) {
x = 0; T f = 1; char c = getchar();
for (; !isdigit(c); c = getchar()) if (c == '-') f = -1;
for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - 48; x *= f;
}
template<class T> void write(T x) {
if (x > 9) write(x / 10); putchar(x % 10 + 48);
}
template<class T> void print(T x,char ed = '\n') {
if(x < 0) putchar('-'), x = -x; write(x), putchar(ed);
}
void solve()
{
ull B;
cin >> B;
int ans = 0;
for(int i = 1; i <= B; i++)
{
double m = pow(i,i);
if(m == B)
{
ans ++;
cout << i;
break;
}
}
if(ans <= 0) cout << "-1";
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T = 1;
while(T--)
{
solve();
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - A^A |
| User | TechNerd233 |
| Language | C++ 20 (gcc 12.2) |
| Score | 0 |
| Code Size | 1217 Byte |
| Status | WA |
| Exec Time | 2210 ms |
| Memory | 3824 KiB |
Compile Error
Main.cpp: In function ‘void read(T&)’:
Main.cpp:23:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
23 | for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - 48; x *= f;
| ^~~
Main.cpp:23:73: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
23 | for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - 48; x *= f;
| ^
Main.cpp: In function ‘void write(T)’:
Main.cpp:27:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
27 | if (x > 9) write(x / 10); putchar(x % 10 + 48);
| ^~
Main.cpp:27:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
27 | if (x > 9) write(x / 10); putchar(x % 10 + 48);
| ^~~~~~~
Main.cpp: In function ‘void print(T, char)’:
Main.cpp:31:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
31 | if(x < 0) putchar('-'), x = -x; write(x), putchar(ed);
| ^~
Main.cpp:31:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
31 | if(x < 0) putchar('-'), x = -x; write(x), putchar(ed);
| ^~~~~
Main.cpp: In function ‘void solve()’:
Main.cpp:39:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘ull’ {aka ‘long long unsigned int’} [-Wsign-compare]
39 | for(int i = 1; i <= B; i++)
| ~~^~~~
Judge Result
| Set Name | Sample | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 200 | ||||||||
| Status |
|
|
| 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 | 3776 KiB |
| 00_sample_01.txt | AC | 1 ms | 3696 KiB |
| 00_sample_02.txt | AC | 1 ms | 3664 KiB |
| 01_random_00.txt | TLE | 2207 ms | 3456 KiB |
| 01_random_01.txt | TLE | 2210 ms | 3488 KiB |
| 01_random_02.txt | TLE | 2207 ms | 3456 KiB |
| 01_random_03.txt | AC | 1 ms | 3700 KiB |
| 01_random_04.txt | AC | 1 ms | 3692 KiB |
| 01_random_05.txt | AC | 1 ms | 3740 KiB |
| 01_random_06.txt | AC | 1 ms | 3616 KiB |
| 01_random_07.txt | AC | 1 ms | 3664 KiB |
| 01_random_08.txt | AC | 1 ms | 3696 KiB |
| 01_random_09.txt | AC | 1 ms | 3752 KiB |
| 02_hack_1_00.txt | WA | 1 ms | 3696 KiB |
| 02_hack_1_01.txt | WA | 1 ms | 3700 KiB |
| 03_hack_2_00.txt | TLE | 2207 ms | 3492 KiB |
| 03_hack_2_01.txt | TLE | 2207 ms | 3504 KiB |
| 03_hack_2_02.txt | TLE | 2207 ms | 3428 KiB |
| 03_hack_2_03.txt | TLE | 2207 ms | 3504 KiB |
| 04_corner_00.txt | AC | 1 ms | 3696 KiB |
| 04_corner_01.txt | AC | 1 ms | 3824 KiB |