We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #3: Largest prime factor
Project Euler #3: Largest prime factor
Contest ends in
Sort by
recency
|
466 Discussions
|
Please Login in order to post a comment
I got 5/6 test case with this in C#. I can't think of anything to shave more process.
i am using c++. For all my code 2 test cases show time exceeded . how can i overcome this
Is there anway to see the test case? I passed 5/6 test cases, the 6th one timed out. Could I unhide it?
import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution {
}
include
include
include
include
include
include
include
unsigned long long findLargestPrimeFactor(unsigned long long n); int isPrime(unsigned long long n);
int main() { int test_case = 0; scanf("%d", &test_case);
}
unsigned long long findLargestPrimeFactor(unsigned long long n) { unsigned long long largest_prime_factor = 1; if (isPrime(n) == 1) { return n; }
}
int isPrime(unsigned long long n) { for (unsigned long long i = 2; i*i <= n; i++) { if (n % i == 0) { return 0; } }
}