The wretched thing about this problem is that you can explode a long long with the fast power middle process.
But I have a way of dealing with a long long.
It's no problem to use a two-point method when you multiply. See Code
#include <iostream> #include <cstdio> #include <cstring> #include <ctime> #include <cstdlib&
Gt #include <algorithm> #include <stack> #include <cmath> #include <vector> #define EPS 1e-6 #define
INF 1000000007 #define PI acos ( -1.0) using namespace std;
Long Long mod = 10000000000LL;
Long long multi (long long A, long long B, long long C) {long long ret = 0;
while (b) {if (b & 1) {ret + = A;
if (ret >= c) ret-= C;
} A + = A;
if (a >= c) A-= C;
b >>= 1;
} return ret;
} Long Long Fastmod (long long A, long long B, long long c)//a^b mod C {Long long ret = 1;
a%= C;
for (; b; b >>= 1, a = multi (A, A, c)) if (b & 1) ret = multi (ret, A, c);
return ret;
} int main () {long long sum = 0;
for (int i = 1; I <=, i++) sum = (sum + fastmod (i, I, MoD))% MoD; cout << sum << endl;
return 0;
}