#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
using namespace std;
int quickMod(int x, int n);
const int MOD = 10007;
class solution {
public:
int x;
vector<int> vc;
solution(int x,vector<int>& vc) {
this->x = x;
this->vc = vc;
}
};
int superPow(solution& s)
{
int x = 1;
for (vector<int>::iterator it = s.vc.end()--;it != s.vc.begin();it--)
{
x *= quickMod(s.x, *it)%MOD;
s.x *= 10;
}
return x;
}
int quickMod(int x, int n) {
if (n == 0)
{
return 1;
}
else if (n == 1)
{
return x;
}
else
{
int y = quickMod(x, n / 2) % MOD;
return n % 2 == 0 ? y * y % MOD : y * y * x % MOD;
}
}
void test(int x) {
vector<int> vc;
vc.push_back(1);
vc.push_back(0);
solution s(x, vc);
cout << superPow(s) << endl;
}
void main() {
int x;
cin >> x;
test(x);
system("pause");
}
有这个问题
我就输入了个2