Submission #27203

#TimeUsernameProblemLanguageResultExecution timeMemory
27203TAMREF팩토리얼 세제곱들의 합 (YDX14_fact)C++11
1 / 1
0 ms1116 KiB
#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); }

Compilation message (stderr)

fact.cpp: In function 'int main()':
fact.cpp:18:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&n,&k);
                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...