# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
10299 | gs14004 | 팩토리얼 세제곱들의 합 (YDX14_fact) | C++98 | 0 ms | 1088 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
int fact(int x){
if(x == 0) return 1;
return fact(x-1) * x % 10000;
}
int pow(int x, int t){
int r = 1;
for (int i=0; i<t; i++) {
r *= x;
r %= 10000;
}
return r;
}
int main(){
int n,k;
scanf("%d %d",&n,&k);
int res = 0;
for (int i=0; i<=n; i++) {
res += pow(fact(i),k);
}
while (res%10 == 0) {
res /= 10;
}
printf("%d",res%10);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |