# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41536 | dudgh623 | 팩토리얼 세제곱들의 합 (YDX14_fact) | C++14 | 2 ms | 956 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 <iostream>
#include <memory.h>
#include <map>
#include <string>
#include <functional>
#include <vector>
using namespace std;
typedef long long ll;
const ll mod=100000000000;
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |