Submission #41537

#TimeUsernameProblemLanguageResultExecution timeMemory
41537dudgh623팩토리얼 세제곱들의 합 (YDX14_fact)C++14
0 / 1
2 ms716 KiB
#include <iostream> #include <memory.h> #include <map> #include <string> #include <functional> #include <vector> using namespace std; typedef long long ll; const ll mod=100000000000000; int main() { ios::sync_with_stdio(false); ll n, k; cin >> n >> k; ll res =0; ll tmp = 0; ll a; for (ll i = 0; i <= n; i++) { tmp = tmp * i; if (i == 0) tmp = 1; a = 1; for (int j = 0; j < k; j++) a = (tmp*a) % mod; res = res + a; } while (1) { if (res == 0) return 0; if (res % 10) { cout << res % 10 << endl; return 0; } else res =res/ 10; } }
#Verdict Execution timeMemoryGrader output
Fetching results...