-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11029.cpp
More file actions
42 lines (41 loc) · 993 Bytes
/
11029.cpp
File metadata and controls
42 lines (41 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* ____
* ____ ___ ____ ________ __/ __/
* / __ `__ \/ __ `/ ___/ / / / /_
* / / / / / / /_/ / / / /_/ / __/
* /_/ /_/ /_/\__,_/_/ \__,_/_/
*
* @link : https://the-redback.com
*/
#include <bits/stdc++.h>
using namespace std;
#define inf HUGE_VAL
#define mem(a, b) memset(a, b, sizeof(a))
#define mod 1000
int big(int n, int k) {
if (k == 1) return n % mod;
if (k % 2)
return ((n % mod) * big(n, k - 1)) % mod;
else {
int pp = big(n, k / 2);
return (pp * pp) % mod;
}
}
int main() {
double m;
char s[50];
int n, k;
int tc, t = 1;
scanf("%d", &tc);
while (tc--) {
scanf("%d%d", &n, &k);
m = (double)k * (double)log10((double)n);
m -= floor(m);
m = pow(10.0, m);
m = m * 1000;
sprintf(s, "%lf", m);
n = big(n, k);
printf("%c%c%c...%03d\n", s[0], s[1], s[2], n);
}
return 0;
}