Open sx349 opened 4 years ago
即让答案对 10^10 取模
#include<bits/stdc++.h>
#define mod 10000000000
int main(){
long long ans = 0;
for(int i = 1;i<=1000;++i){
long long tmp = 1;
for(int j = 1;j<=i;++j) tmp = tmp*i%mod;
ans = (ans+tmp)%mod;
}
return printf("%lld",ans),0;
}
ans=0
p=10**10
for i in range(1,1001):
ans=(ans+pow(i,i,p))%p
print(ans)
#include <stdio.h>
long long int selfpow(int x);
int main()
{
long long int sum = 0;
for (int i = 1; i <= 1000; ++i) {
sum += selfpow(i);
sum %= 10000000000;
}
printf("%lld\n", sum);
return 0;
}
long long int selfpow(int x) {
int i;
long long int y = (long long)x;
for (i = 1; i < x; ++i) {
y *= (long long)x;
y %= 10000000000;
}
return y;
}
FromDigits@Take[IntegerDigits@Sum[n^n, {n, 1000}], -10]
https://pe-cn.github.io/48/
Problem 48 Self powers The series, 11 + 22 + 33 + … + 1010 = 10405071317. Find the last ten digits of the series, 11 + 22 + 33 + … + 10001000. 自幂 十项的自幂级数求和为 11 + 22 + 33 + … + 1010 = 10405071317。 求如