Submission #1067315


Source Code Expand

#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

long primeCounter(long n)
{
	long j ,c = 1;
	for (long i = 2; i * i <= n; i++, c *= j)
	{
		for (j = 1; !(n % i); j++)
		{
			n /= i;
		}
	}
	return (1 < n) ? c * 2 : c;
}

long factorial(long n)
{
	long fact = 1;
	for (long i = 1; i <= n; ++i)
	{
		fact = fact * i;
	}

	return fact;
}

int main()
{
	int N;
	cin >> N;
	
	long fact = factorial(N);
	long primeNum = primeCounter(fact);
	long ans = primeNum % ((long)pow(10, 9) + 7);
	printf("%d\n", ans);
}

Submission Info

Submission Time
Task C - Factors of Factorial
User zigzagzackey
Language C++14 (GCC 5.4.1)
Score 0
Code Size 574 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:38:40: error: ‘pow’ was not declared in this scope
  long ans = primeNum % ((long)pow(10, 9) + 7);
                                        ^
./Main.cpp:39:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
  printf("%d\n", ans);
                    ^