Submission #21159

#TimeUsernameProblemLanguageResultExecution timeMemory
21159jayceking팩토리얼 세제곱들의 합 (YDX14_fact)C++14
0 / 1
0 ms1116 KiB
#include<cstdio> int pow(int a, int b, int c) { if (b == 0) return c; pow(a, b - 1, a*c); } int main() { int n, k; scanf("%d %d", &n, &k); int d = 0; int arr[5] = { 1,1,2,6,24 }; if (n > 4) { for (int i = 0;i <= 4;++i) { d += pow(arr[i], k, 1); } } else { for (int i = 0;i <= n;++i) { d += pow(arr[i], k, 1); } } while (d % 10==0) { d /= 10; } printf("%d", d % 10); }

Compilation message (stderr)

fact.cpp: In function 'int pow(int, int, int)':
fact.cpp:6:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
fact.cpp: In function 'int main()':
fact.cpp:10:24: 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...