제출 #16631

#제출 시각아이디문제언어결과실행 시간메모리
16631eaststar팩토리얼 세제곱들의 합 (YDX14_fact)C++14
1 / 1
0 ms1916 KiB
#include <bits/stdc++.h>
int a[5]={1,1,2,6,24},s;
int main(){
    int i,n,k;
    scanf("%d%d",&n,&k);
    if(!k)s=n+1;
    else for(i=0;i<=n&&i<5;++i)s+=pow(a[i],k);
    while(s%10==0)s/=10;
    printf("%d",s%10);
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...